Skip to content

Commit

Permalink
measure execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
nrenvoise-ubitransport committed Nov 22, 2021
1 parent 3c50b62 commit b459e0c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions time/measure_execution_time/measure_execution_time.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

function myBigFunction($durationInSeconds)
{
echo "Hello";
for ($i = 0; $i < $durationInSeconds; $i++) {
echo ".";
sleep(1);
}
echo " World!\n";
}

$start = microtime(true);
myBigFunction(3);
$duration = microtime(true) - $start;
echo "Elapsed time $duration s\n";



$start = microtime(true);
myBigFunction(3);
var_dump(microtime(true) - $start);
exit();

0 comments on commit b459e0c

Please sign in to comment.