PHP code example of PHPUnit / PHP-Timer timing

1. Go to this page and download the library: Download phpunit/php-timer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.

/* Start to develop here. Best regards */


PHPUnit / PHP-Timer timing example snippets

// Basic Timing
use SebastianBergmann\Timer\Timer;


$time = Timer::stop();

print Timer::secondsToTimeString($time);

The code above yields the output below:

0 ms 

// Resource Consumption Since PHP Startup

print Timer::resourceUsage();

The code above yields the output below:

Time: 0 ms, Memory: 0.50MB