3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(\DateTime::createFromFormat('Y-m-d', '2015-06-22')); $birthday = date('d-m-Y', strtotime('0000-00-00')); $birthDate = explode('-', $birthday); echo $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2]));
based on QRSd3
Output for 7.1.0 - 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-22 18:33:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: mktime() expects parameter 6 to be integer, string given in /in/DhT62 on line 8 Warning: A non-numeric value encountered in /in/DhT62 on line 10 2015
Output for 7.0.0 - 7.0.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-22 18:33:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: mktime() expects parameter 6 to be integer, string given in /in/DhT62 on line 8 2015
Output for 5.4.30 - 5.4.45, 5.5.14 - 5.6.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-22 18:33:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: mktime() expects parameter 6 to be long, string given in /in/DhT62 on line 8 2015
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-06-22 18:33:59" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: mktime() expects parameter 6 to be long, string given in /in/DhT62 on line 8 2015