3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dumpMappedRow($mappedRow) { var_dump([ 'created' => $mappedRow['created']->format(DateTime::ISO8601), 'modified' => $mappedRow['modified']->format(DateTime::ISO8601) ]); } function objectDemo() { $date = new DateTime(); $mappedRow['created'] = $date; $mappedRow['modified'] = $date; dumpMappedRow($mappedRow); $mappedRow['modified']->setDate("2015", "11", "15"); dumpMappedRow($mappedRow); if ($mappedRow['created']->getTimestamp() === $mappedRow['modified']->getTimestamp()) { echo "\nCreated and Modified are set to the same value."; } } function stringDemo() { $date = "2015-09-24T21:17:43+0200"; $mappedRow['created'] = $date; $mappedRow['modified'] = $date; var_dump($mappedRow); $mappedRow['modified'] = "2015-11-24T21:17:43+0200"; var_dump($mappedRow); if ($mappedRow['created']->getTimestamp() === $mappedRow['modified']->getTimestamp()) { echo "\nCreated and Modified are set to the same value."; } } objectDemo(); echo "\n\n==========\n\n"; stringDemo();
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["created"]=> string(24) "2015-09-24T21:19:28+0200" ["modified"]=> string(24) "2015-09-24T21:19:28+0200" } array(2) { ["created"]=> string(24) "2015-11-15T21:19:28+0100" ["modified"]=> string(24) "2015-11-15T21:19:28+0100" } Created and Modified are set to the same value. ========== array(2) { ["created"]=> string(24) "2015-09-24T21:17:43+0200" ["modified"]=> string(24) "2015-09-24T21:17:43+0200" } array(2) { ["created"]=> string(24) "2015-09-24T21:17:43+0200" ["modified"]=> string(24) "2015-11-24T21:17:43+0200" } Fatal error: Uncaught Error: Call to a member function getTimestamp() on string in /in/Wr8UT:43 Stack trace: #0 /in/Wr8UT(51): stringDemo() #1 {main} thrown in /in/Wr8UT on line 43
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.16 ms | 402 KiB | 8 Q