3v4l.org

run code in 300+ PHP versions simultaneously
<?php $seconds = 2; $h = $seconds / 3600 % 24; $m = $seconds / 60 % 60; $s = $seconds % 60; $output = array(); if ($w >= 1) $output[] = "{$w} ".($w == 1 ? i18n::get('week') : i18n::get('weeks')); if ($d >= 1) $output[] = "{$d} ".($d == 1 ? i18n::get('day') : i18n::get('days')); if ($h >= 1) $output[] = "{$h} ".($h == 1 ? i18n::get('hour') : i18n::get('hours')); if ($m >= 1) $output[] = "{$m} ".($m == 1 ? i18n::get('minute') : i18n::get('minutes')); if ($s >= 1) $output[] = "{$s} ".($s == 1 ? i18n::get('second') : i18n::get('seconds')); echo implode(', ', $output);

preferences:
62.31 ms | 402 KiB | 5 Q