3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = '09-02-2018'; $d = DateTime::createFromFormat('d-m-Y', $date); var_dump($d); var_dump($d && $d->format($format) === $date);
based on Dlpfm
Output for 5.6.0 - 5.6.30, hhvm-3.21.3, 7.0.0 - 7.3.0beta1
object(DateTime)#1 (3) { ["date"]=> string(26) "2018-02-09 09:35:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Notice: Undefined variable: format in /in/4qpM2 on line 9 bool(false)
Output for hhvm-3.22.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2018-02-09 09:35:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Notice: Undefined variable: format in /in/4qpM2 on line -1 bool(false)
Output for hhvm-3.18.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2018-02-09 09:35:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Notice: Undefined variable: format in /in/4qpM2 on line 9 bool(false)