+ 1

How do you test speed of PHP code?

Hi guys, I am just beginning to learn coding. I have written two program in PHP to check for prime numbers in a loop. But I notice it takes a while to get the results. So how do I check for speed of the code? Any help to optimize the code will be appreciated. I am a newbie so my code is probably very very basic. https://code.sololearn.com/w8IqRFfQEaQX/#php https://code.sololearn.com/wnCnzqCf973a/#php

5th May 2018, 5:14 AM
Nft
4 Respuestas
+ 2
Not sure. But you should definitely start working on your computer. It's much better. I'm sure the online program has some limitations.
5th May 2018, 5:37 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
There are many tools made to measure it. You can also use XDebug because it logs your time.
5th May 2018, 5:29 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
Thank you Ben, it probably does have limitations. As I said... I am quite new to coding. This is just my second code on php...
5th May 2018, 5:43 AM
Nft
0
I actually use an online site to write the PHP codes. (http://sandbox.onlinephpfunctions.com/) So using tools or the Xdebug program won't work for me at the moment. But I will keep these things in mind for later. Is there a way by code I can check for speed?
5th May 2018, 5:36 AM
Nft