3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function dumpMappedRow($mappedRow) { var_dump([ 'created' => $mappedRow['created']->format(DateTime::ISO8601), 'modified' => $mappedRow['modified']->format(DateTime::ISO8601) ]); } $date = new DateTime(); $mappedRow['created'] = $date; $mappedRow['modified'] = $date; dumpMappedRow($mappedRow); $mappedRow['modified']->add(new DateInterval("1D")); dumpMappedRow($mappedRow);
based on KjkHD
Output for 7.0.0 - 7.2.0
array(2) { ["created"]=> string(24) "2015-09-24T21:14:04+0200" ["modified"]=> string(24) "2015-09-24T21:14:04+0200" } Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format (1D) in /in/9QRli:18 Stack trace: #0 /in/9QRli(18): DateInterval->__construct('1D') #1 {main} thrown in /in/9QRli on line 18
Process exited with code 255.
Output for 5.4.0 - 5.6.28
array(2) { ["created"]=> string(24) "2015-09-24T21:14:04+0200" ["modified"]=> string(24) "2015-09-24T21:14:04+0200" } Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct(): Unknown or bad format (1D)' in /in/9QRli:18 Stack trace: #0 /in/9QRli(18): DateInterval->__construct('1D') #1 {main} thrown in /in/9QRli on line 18
Process exited with code 255.