3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function timePassed($time){ $time = time() - $time; $tokens = array ( 31536000 => 'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second' ); foreach ($tokens as $unit => $text) { if ($time < $unit) continue; $numberOfUnits = floor($time / $unit); return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':''); } } timePassed('2014-04-03 19:21:30');
Output for 7.1.0
Notice: A non well formed numeric value encountered in /in/CCctC on line 3
Output for 4.3.0 - 7.0.14