3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $b = new DateTime(); echo "Current: ".$b->format('Y-m-d H:i:s'); echo "\r\n"; echo "\r\n"; $t = new DateTime("07:00", new DateTimeZone('America/New_York')); $t->setTimezone(new DateTimeZone('UTC')); echo "ET: ".$t->format('Y-m-d H:i:s'); $f = (new DateTime())->setTimezone(new DateTimeZone('America/New_York')); $f->setTime(7,0); $f->setTimezone(new DateTimeZone('UTC')); echo "\r\n"; echo "ET Second Way: ".$f->format('Y-m-d H:i:s'); echo "\r\n"; $t = new DateTime("07:00", new DateTimeZone('America/Chicago')); $t->setTimezone(new DateTimeZone('UTC')); echo "ET: ".$t->format('Y-m-d H:i:s'); $f = (new DateTime())->setTimezone(new DateTimeZone('America/Chicago')); $f->setTime(7,0); $f->setTimezone(new DateTimeZone('UTC')); echo "\r\n"; echo "ET Second Way: ".$f->format('Y-m-d H:i:s'); echo "\r\n"; $t = new DateTime("07:00", new DateTimeZone('America/Denver')); $t->setTimezone(new DateTimeZone('UTC')); echo "ET: ".$t->format('Y-m-d H:i:s'); $f = (new DateTime())->setTimezone(new DateTimeZone('America/Denver')); $f->setTime(7,0); $f->setTimezone(new DateTimeZone('UTC')); echo "\r\n"; echo "ET Second Way: ".$f->format('Y-m-d H:i:s'); echo "\r\n"; $t = new DateTime("07:00", new DateTimeZone('America/Los_Angeles')); $t->setTimezone(new DateTimeZone('UTC')); echo "ET: ".$t->format('Y-m-d H:i:s'); $f = (new DateTime())->setTimezone(new DateTimeZone('America/Los_Angeles')); $f->setTime(7,0); $f->setTimezone(new DateTimeZone('UTC')); echo "\r\n"; echo "ET Second Way: ".$f->format('Y-m-d H:i:s'); echo "\r\n---"; $f = new DateTime("07:00", new DateTimeZone('America/Chicago')); $f->setTimezone(new DateTimeZone('UTC')); echo $f->format('Y-m-d H:i:s'); echo "\r\n"; echo "\r\n"; $f = new DateTime(); $f->setTimezone(new DateTimeZone('America/Chicago')); echo $f->format('Y-m-d H:i:s'); $f = new DateTime(); $f->setTime(7,0); echo "\r\n"; $f->setTimezone(new DateTimeZone('America/Chicago')); echo $f->format('Y-m-d H:i:s'); echo "\r\n"; echo "\r\n"; $g = new DateTime("07:00", new DateTimeZone('America/Denver')); $g->setTimezone(new DateTimeZone('UTC')); echo $g->format('Y-m-d H:i:s'); echo "\r\n"; $h = new DateTime("07:00", new DateTimeZone('America/Los_Angeles')); $h->setTimezone(new DateTimeZone('UTC')); echo $h->format('Y-m-d H:i:s'); echo "\r\n"; echo strtotime('today 7am'); echo "\r\n"; echo (DateTime::createFromFormat('Y-m-d H:i:s', strtotime('today 7am')))->format('Y-m-d H:i:s');
Output for git.master, git.master_jit
Current: 2020-10-18 02:24:58 ET: 2020-10-17 11:00:00 ET Second Way: 2020-10-17 11:00:00 ET: 2020-10-17 12:00:00 ET Second Way: 2020-10-17 12:00:00 ET: 2020-10-17 13:00:00 ET Second Way: 2020-10-17 13:00:00 ET: 2020-10-17 14:00:00 ET Second Way: 2020-10-17 14:00:00 ---2020-10-17 12:00:00 2020-10-17 21:24:58 2020-10-18 02:00:00 2020-10-17 13:00:00 2020-10-17 14:00:00 1603004400 Fatal error: Uncaught Error: Call to a member function format() on bool in /in/AKq75:79 Stack trace: #0 {main} thrown in /in/AKq75 on line 79
Process exited with code 255.
Output for rfc.property-hooks
Current: 2020-10-18 02:24:58 ET: 2020-10-17 11:00:00 ET Second Way: 2020-10-17 11:00:00 ET: 2020-10-17 12:00:00 ET Second Way: 2020-10-17 12:00:00 ET: 2020-10-17 13:00:00 ET Second Way: 2020-10-17 13:00:00 ET: 2020-10-17 14:00:00 ET Second Way: 2020-10-17 14:00:00 ---2020-10-17 12:00:00 2020-10-17 21:24:58 2020-10-18 02:00:00 2020-10-17 13:00:00 2020-10-17 14:00:00 1603004400 Fatal error: Uncaught Error: Call to a member function format() on false in /in/AKq75:79 Stack trace: #0 {main} thrown in /in/AKq75 on line 79
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:
44.32 ms | 401 KiB | 8 Q