3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = str_pad(intval(strval("0219")), 4, 0, STR_PAD_LEFT); $test2 = str_pad(intval(date('my')), 4, 0, STR_PAD_LEFT); $test3 = intval(strval("0717")); $test4 = intval(date('my')); $time1 = mktime(1, 1, 1, intval("08"), 1, intval("17")); $time2 = mktime(1, 1, 1, intval(date('m')), 1, intval(date('y'))); echo $time1; echo "<br/>"; echo $time2; $toto = "0919"; $expiration_time = mktime(1, 1, 1, intval(substr($toto->expiration_date, 0, 2)), 1, intval(substr($toto->expiration_date, 2, 2))); $current_time = mktime(1, 1, 1, intval(date('m')), 1, intval(date('y'))); if ($expiration_time < $current_time){ echo "KO"; } else{ echo "OK"; } ?>
based on iKh9B
Output for 7.2.0 - 7.3.0rc3
1501542061<br/>1498863661 Notice: Trying to get property 'expiration_date' of non-object in /in/OI02A on line 14 Notice: Trying to get property 'expiration_date' of non-object in /in/OI02A on line 14 KO
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.20
1501542061<br/>1498863661 Notice: Trying to get property of non-object in /in/OI02A on line 14 Notice: Trying to get property of non-object in /in/OI02A on line 14 KO
Output for hhvm-3.15.4
1501542061<br/>1498863661 Notice: Cannot access property on non-object in /in/OI02A on line 14 Warning: substr() expects parameter 1 to be string, null given in /in/OI02A on line 14 Notice: Cannot access property on non-object in /in/OI02A on line 14 Warning: substr() expects parameter 1 to be string, null given in /in/OI02A on line 14 KO