3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ago($when) { $diff = date("U") - $when; // Days $day = floor($diff / 86400); $diff = $diff - ($day * 86400); // Hours $hrs = floor($diff / 3600); $diff = $diff - ($hrs * 3600); // Mins $min = floor($diff / 60); $diff = $diff - ($min * 60); // Secs $sec = $diff; // Return how long ago this was. eg: 3d 17h 4m 18s ago // Skips left fields if they aren't necessary, eg. 16h 0m 27s ago / 10m 7s ago $str = sprintf("%s%s%s%s", $day != 0 ? $day."d " : "", ($day != 0 || $hrs != 0) ? $hrs."h " : "", ($day != 0 || $hrs != 0 || $min != 0) ? $min."m " : "", $sec."s ago" ); return $str; } echo ago(3600);
Output for git.master, git.master_jit, rfc.property-hooks
16150d 5h 30m 43s 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:
35.53 ms | 401 KiB | 8 Q