3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function blah($days){ if($days < 7) return "$days days"; if($days <= 31) return (int)($days / 7) . " weeks"; if($days <= 365) return (int)($days / 30) . " months"; return (int)($days / 365) . " years"; } echo blah (5) . "\n"; echo blah (25) . "\n"; echo blah (225) . "\n"; echo blah (2225) . "\n";
Output for 7.1.25 - 7.3.1
5 days 3 weeks 7 months 6 years