3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$connection = mysql_connect('localhost', 'root','abcABC123'); //mysql_select_db('pearson', $connection); //ini_set('date.timezone', 'US/Eastern'); //date_default_timezone_set('Europe/London'); echo "PHP INI SETTING : " . ini_get('date.timezone') . "</br>"; echo "Current timezone: " . date_default_timezone_get() . "</br>"; $date = new DateTime(); var_dump(new DateTime()); echo "</br>------------------------------------ DateTime Constants -------------------------------------------------</br>"; echo "DATE_ATOM - " . $date->format(DATE_ATOM) . "</br>" ; echo "DATE_ISO8601 - " . $date->format(DATE_ISO8601) . "</br>" ; echo "DATE_RFC822 - " . $date->format(DATE_RFC822) . "</br>" ; echo "DATE_RSS - " . $date->format(DATE_RSS) . "</br>" ; echo "</br>-------------------------------------- Operation with Date -----------------------------------------------</br>"; echo "Offset to GMT - " . $date->getOffset() . "</br>" ; echo "Date modify - " . $date->modify('+2 week')->format(DATE_RSS) . "</br>" ; echo "</br>-------------------------------------- Operation with Timezone -----------------------------------------------</br>"; echo "http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone </br>" ; echo "Timestamp - " . $date->getTimestamp(). "</br>" ; $timeZone = new DateTimeZone("Europe/Moscow"); $date->setTimezone($timeZone); //var_dump($timeZone->getTransitions()); //var_dump(timezone_identifiers_list()); var_dump($date); echo "Timezone offset to GMT - " . $timeZone->getOffset(new DateTime()) . "</br>" ; echo "</br>-------------------------------------- MYSQL -----------------------------------------------</br>" ; $sql = "INSERT INTO date_date(my_timestamp, datetime) VALUES(\"". CURRENT_TIMESTAMP . "\",\"" . $date->format("d-m-y H:i:s") . "\")"; echo $sql . "</br>"; mysql_query($sql); $result = mysql_query('SELECT datetime FROM date_date'); while ($row = mysql_fetch_assoc($result)) { $userTimeZone = new DateTimeZone('Europe/Oslo'); if (!empty($row["datetime"])) { $dt = new DateTime($row["datetime"]); $dt->setTimezone($userTimeZone); echo "</br>" . $dt->format("r") . "</br>"; } } echo "</br>-------------------------------------- Prooof links-----------------------------------------------</br>" ; echo "http://www.worldtimezone.com/index24.php </br>" ; echo "http://www.sitepoint.com/forums/showthread.php?450107-Difference-between-GMT-and-PST#post3243632</br>" ;
Output for git.master
PHP INI SETTING : Europe/Amsterdam</br>Current timezone: Europe/Amsterdam</br>object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-17 10:53:48.003601" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } </br>------------------------------------ DateTime Constants -------------------------------------------------</br>DATE_ATOM - 2014-12-17T10:53:48+01:00</br>DATE_ISO8601 - 2014-12-17T10:53:48+0100</br>DATE_RFC822 - Wed, 17 Dec 14 10:53:48 +0100</br>DATE_RSS - Wed, 17 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Date -----------------------------------------------</br>Offset to GMT - 3600</br>Date modify - Wed, 31 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Timezone -----------------------------------------------</br>http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone </br>Timestamp - 1420019628</br>object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-31 12:53:48.003593" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } Timezone offset to GMT - 10800</br></br>-------------------------------------- MYSQL -----------------------------------------------</br> Fatal error: Uncaught Error: Undefined constant "CURRENT_TIMESTAMP" in /in/RGLEh:40 Stack trace: #0 {main} thrown in /in/RGLEh on line 40
Process exited with code 255.
Output for git.master_jit
PHP INI SETTING : Europe/Amsterdam</br>Current timezone: Europe/Amsterdam</br>object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-17 10:53:48.003917" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } </br>------------------------------------ DateTime Constants -------------------------------------------------</br>DATE_ATOM - 2014-12-17T10:53:48+01:00</br>DATE_ISO8601 - 2014-12-17T10:53:48+0100</br>DATE_RFC822 - Wed, 17 Dec 14 10:53:48 +0100</br>DATE_RSS - Wed, 17 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Date -----------------------------------------------</br>Offset to GMT - 3600</br>Date modify - Wed, 31 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Timezone -----------------------------------------------</br>http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone </br>Timestamp - 1420019628</br>object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-31 12:53:48.003911" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } Timezone offset to GMT - 10800</br></br>-------------------------------------- MYSQL -----------------------------------------------</br> Fatal error: Uncaught Error: Undefined constant "CURRENT_TIMESTAMP" in /in/RGLEh:40 Stack trace: #0 {main} thrown in /in/RGLEh on line 40
Process exited with code 255.
Output for rfc.property-hooks
PHP INI SETTING : Europe/Amsterdam</br>Current timezone: Europe/Amsterdam</br>object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-17 10:53:48.003988" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } </br>------------------------------------ DateTime Constants -------------------------------------------------</br>DATE_ATOM - 2014-12-17T10:53:48+01:00</br>DATE_ISO8601 - 2014-12-17T10:53:48+0100</br>DATE_RFC822 - Wed, 17 Dec 14 10:53:48 +0100</br>DATE_RSS - Wed, 17 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Date -----------------------------------------------</br>Offset to GMT - 3600</br>Date modify - Wed, 31 Dec 2014 10:53:48 +0100</br></br>-------------------------------------- Operation with Timezone -----------------------------------------------</br>http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone </br>Timestamp - 1420019628</br>object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-31 12:53:48.003979" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } Timezone offset to GMT - 10800</br></br>-------------------------------------- MYSQL -----------------------------------------------</br> Fatal error: Uncaught Error: Undefined constant "CURRENT_TIMESTAMP" in /in/RGLEh:40 Stack trace: #0 {main} thrown in /in/RGLEh on line 40
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:
42.34 ms | 402 KiB | 8 Q