3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertUnixTimeBetweenTimezones($vUnixTime,$vOriginalTimezone,$vDesiredTimezone) { // set default to desired timezone $vCurrentTimezone = date_default_timezone_get(); date_default_timezone_set($vDesiredTimezone); $oBaseTimeZone = new DateTimeZone($vOriginalTimezone); // user time zone $oCurrentTimeZone = new DateTimeZone($vDesiredTimezone); //$vIsoTime = date("Y-m-d H:i:s",$vUnixTime); $oBaseTime = new DateTime("@{$vIsoTime}",$oBaseTimeZone); $oBaseTime->setTimezone($oCurrentTimeZone); $vTimeStamp = $oBaseTime->getTimestamp(); date_default_timezone_set($vCurrentTimezone); return $vTimeStamp; } echo convertUnixTimeBetweenTimezones(1414710000,"EST","UTC"); ?>
Output for git.master, git.master_jit
Warning: Undefined variable $vIsoTime in /in/UbVvu on line 14 Fatal error: Uncaught Exception: Failed to parse time string (@) at position 0 (@): Unexpected character in /in/UbVvu:14 Stack trace: #0 /in/UbVvu(14): DateTime->__construct('@', Object(DateTimeZone)) #1 /in/UbVvu(26): convertUnixTimeBetweenTimezones(1414710000, 'EST', 'UTC') #2 {main} thrown in /in/UbVvu on line 14
Process exited with code 255.
Output for rfc.property-hooks
Warning: Undefined variable $vIsoTime in /in/UbVvu on line 14 Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (@) at position 0 (@): Unexpected character in /in/UbVvu:14 Stack trace: #0 /in/UbVvu(14): DateTime->__construct('@', Object(DateTimeZone)) #1 /in/UbVvu(26): convertUnixTimeBetweenTimezones(1414710000, 'EST', 'UTC') #2 {main} thrown in /in/UbVvu on line 14
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:
49.25 ms | 401 KiB | 8 Q