3v4l.org

run code in 300+ PHP versions simultaneously
<?php function time_elapsed_string($ptime) { $etime = $ptime; if ($etime < 1) { return '0 seconds'; } $a = array( 12 * 30 * 24 * 60 * 60 => 'year', 30 * 24 * 60 * 60 => 'month', 24 * 60 * 60 => 'day', 60 * 60 => 'hour', 60 => 'minute', 1 => 'second' ); foreach ($a as $secs => $str) { $d = $etime / $secs; if ($d >= 1) { $r = round($d); return $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago'; } } } echo time_elapsed_string(3661);
Output for git.master, git.master_jit, rfc.property-hooks
1 hour ago

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
67.63 ms | 401 KiB | 8 Q