3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateTimeExample = new DateTime('2009-01-05 12:34:56'); $dateTimes = [ $dateTimeExample->format('Y-m-d H:i:s'), $dateTimeExample->format('c'), $dateTimeExample->format('Y-m-d') ]; var_dump($dateTimes); foreach($dateTimes as $input){ preg_match('~(?<date>\d{4}-\d{2}-\d{2})[\s|T]?(?<time>\d{2}:\d{2}:\d{2})?(?<timezone>[\+|-]\d{2}:\d{2})?~', $input, $matches); $matches['time'] = array_key_exists('time', $matches) ? $matches['time'] : '00:00:00'; $dateTime = sprintf('%s %s', $matches['date'], $matches['time']); $timeZone = array_key_exists('timezone', $matches) ? new \DateTimeZone($matches['timezone']) : new \DateTimeZone('Europe/Amsterdam'); var_dump(\DateTime::createFromFormat('Y-m-d H:i:s', $dateTime, $timeZone)->format('c')); }
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> string(19) "2009-01-05 12:34:56" [1]=> string(25) "2009-01-05T12:34:56+01:00" [2]=> string(10) "2009-01-05" } string(25) "2009-01-05T12:34:56+01:00" string(25) "2009-01-05T12:34:56+01:00" string(25) "2009-01-05T00:00:00+01:00"

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