3v4l.org

run code in 300+ PHP versions simultaneously
<?php function buildDatetime($time, $now, $zone) { $datetime = new \DateTime(); $datetime->setTimestamp(strtotime($time, $now)); $datetime->setTimezone(new DateTimezone($zone)); return $datetime; } $now = new \DateTime('2000-01-02 00:00:00', new \DateTimeZone('UTC')); date_default_timezone_set('America/Los_Angeles'); $date = buildDatetime('yesterday', $now->getTimestamp(), 'UTC'); var_dump($date->format('c'), $date->getTimezone()->getName());
Output for git.master, git.master_jit, rfc.property-hooks
string(25) "1999-12-31T08:00:00+00:00" string(3) "UTC"

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:
65.86 ms | 401 KiB | 8 Q