3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if('12/10/2000' < '10/10/2000') echo "true\n"; else echo "false\n"; $data = date('d/m/Y'); print_r($data); echo "\n"; $data1 = DateTime::createFromFormat('d/m/Y', $data); $data2 = DateTime::createFromFormat('d/m/Y', $data); echo $data1 == $data2->add(new DateInterval('P1D')) ? "iguais\n" : "diferentes\n"; $arr = array(array(), array()); print_r($arr); if(empty($arr)) echo "empty\n"; else echo "not empty\n"; $data3 = DateTime::createFromFormat('d/m/Y', '30/30/2000'); print_r($data3->getLastErrors()); print_r(array_sum($data3->getLastErrors()));
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
false 11/12/2013 diferentes Array ( [0] => Array ( ) [1] => Array ( ) ) not empty Array ( [warning_count] => 1 [warnings] => Array ( [10] => The parsed date was invalid ) [error_count] => 0 [errors] => Array ( ) ) 1
Output for 5.2.10 - 5.2.17
false 11/12/2013 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/39eA0 on line 7
Process exited with code 255.
Output for 5.2.0 - 5.2.9
false 11/12/2013 Fatal error: Call to undefined method DateTime::createfromformat() in /in/39eA0 on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
false 11/12/2013 Fatal error: Class 'DateTime' not found in /in/39eA0 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
false 11/12/2013 Fatal error: Undefined class name 'datetime' in /in/39eA0 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
false 11/12/2013 Fatal error: Undefined class name 'datetime' in /in/39eA0 on line 7