Skip to content

Instantly share code, notes, and snippets.

@Lammerink
Last active September 2, 2016 11:36
Show Gist options
  • Save Lammerink/3925132 to your computer and use it in GitHub Desktop.
Save Lammerink/3925132 to your computer and use it in GitHub Desktop.
PHP : Generated in X Seconds
<?php
//Generated in X Seconds Helper
//Put this at the top of the script
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
?>
<?php
//To show "Ganerated in X Seconds"
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo "</br> Page generated in $total_time seconds.\n";
?>
@emresaracoglu
Copy link

Hello
Page generated in 1472815903.7429 seconds
How can I do "X seconds" for humans ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment