3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function interval_format($value, $source = 'seconds'){ $hours = 0; $minutes = 0; $seconds = 0; switch($source){ case 's': case 'seconds': $seconds = $value % 60; $value = $minutes = (int)($value / 60); case 'm': case 'minutes': $minutes = $value % 60; $value = $hours = (int)($value / 60); case 'h': case 'hours': $hours= $value % 24; $value = $days = (int)($value / 25); } $str = ''; if(!empty($hours)) $str .= sprintf('%u %s ', $hours, self::t('Sekunden')); if(!empty($minutes)) $str .= sprintf('%u %s ', $minutes, self::t('Minuten')); if(!empty($seconds)) $str .= sprintf('%u %s ', $seconds, self::t('Sekunden')); return trim($str); } echo interval_format(50);
Output for 5.0.0 - 5.4.31
Fatal error: Cannot access self:: when no class scope is active in /in/LWTtL on line 33
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Undefined class name 'self' in /in/LWTtL on line 33
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'self' in /in/LWTtL on line 33