3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(DateTimeImmutable::createFromMutable(new DateTime('midnight'))); var_dump(DateTimeImmutable::createFromMutable(new DateTimeImmutable('midnight')));
based on sHrQ2
Output for 5.6.0 - 7.3.1
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-09-24 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in /in/3IrR6 on line 4 NULL
Output for 5.5.0 - 5.5.38
Fatal error: Call to undefined method DateTimeImmutable::createFromMutable() in /in/3IrR6 on line 3
Process exited with code 255.
Output for 5.3.18 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/3IrR6 on line 3
Process exited with code 255.