3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = new DateTime('now'); $expire_date = date('Y-m-d H:i:s', strtotime('+3 weeks')); $expire_on = new DateTime($expire_date); $time_left = $now->diff($expire_on); echo format_interval($time_left); function format_interval($time_left) { $format_string = ""; $weeks = (int) ($time_left->d / 7); $days = (int) ($time_left->d - ($weeks * 7)); if ($time_left->y > 0) $format_string = "%y year(s), %m month(s), $weeks week(s), $days day(s), %h hour(s) and %i minute(s)"; elseif ($time_left->m > 0) $format_string = "%m month(s), $weeks week(s), $days day(s), %h hour(s) and %i minute(s)"; elseif ($weeks > 0) $format_string = "$weeks week(s), $days day(s), %h hour(s) and %i minute(s)"; elseif ($time_left->d > 0) $format_string = "$days day(s), %h hour(s) and %i minute(s)"; elseif ($time_left->h > 0) $format_string = "%h hour(s) and %i minute(s)"; elseif ($time_left->i > 0) $format_string = "%i minute(s)"; else $format_string = "%s second(s)"; return $time_left->format($format_string); }
Output for git.master_jit, git.master, rfc.property-hooks
2 week(s), 6 day(s), 23 hour(s) and 59 minute(s)

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:
89.48 ms | 405 KiB | 5 Q