3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function diff($diff) { if (24*60*60*60 < $diff) { // 60 days return 'week'; } elseif (24*60*60 < $diff) { // 24 hours return 'day'; } elseif (60*60 < $diff) { // 60 minutes return 'hour'; } elseif (2*60 < $diff) { // 2 minutes return 'minute'; } else { return 'second'; } } echo diff(1393887600-1393844400);
Output for 4.3.0 - 7.1.0
hour