LMSouq
php-dev Open

Simplest way to profile a PHP script

MA
Mark Biek
1 month ago
3 views
Problem Description
What's the easiest way to profile a PHP script? I'd love tacking something on that shows me a dump of all function calls and how long they took, but I'm also OK with putting something around specific functions. I tried experimenting with the [microtime][1] function: $then = microtime(); myFunc(); $now = microtime(); echo sprintf("Elapsed: %f", $now-$then); But that sometimes gives me negative results. Plus it's a lot of trouble to sprinkle that all over my code. [1]: http://php.net/microtime

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base