I would love to know if this script is good to know the execution of php script ?
for miliseconds
<?php
$timestart = microtime(true);
/* Blah Blah here ... */
$timeend = microtime(true);
echo 'Execution Time : '.round((timeend - timestart) * 1000, 2);
?>
I have no ideas about using OOP (object-oriented programming) with it.
Also I’ll make a script who will parse a text files (.txt), I’ll have maybe 120 – 700 lines, which way is better to know the data treatment ?
Does the time depend on number of lines?
I use this Timer class i wrote some time ago. An advantage is that it’s “incremental” you can start a timer inside a loop, and it will append the time between start and stop.
Please note that if you do that, it will had quite some time to execution.
basic usage:
please note it’s limited and far not the fastest way to do it. creating and destoying classes takes time. When done inside “logical” loops, it can add quite some time. but to trace some complex program with multiple imbricated loops, or recursive functions calls, this stuff is precious