3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user_date_str = '2015/11/06 19:27:21'; $user_tz = 'America/Los_Angeles'; $server_tz = 'UTC'; // Get a DateTime object for the user entered time $user_datetime = new DateTime($user_date_str, new DateTimeZone($user_tz) ); // Change time zone to the same as the server $user_datetime->setTimeZone(new DateTimeZone($server_tz)); // Get a DateTime object for the current server time //$server_datetime = new DateTime(); // If the PHP timezone isn't set correctly, you can also do: $server_datetime = new DateTime(null, new DateTimeZone($server_tz) ); var_dump($user_datetime, $server_datetime); // Now compare if ($user_datetime < $server_datetime) { }
Output for git.master
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/LVmAt on line 15 object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-07 03:27:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-06 20:13:19.003656" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for git.master_jit
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/LVmAt on line 15 object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-07 03:27:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-06 20:13:19.004274" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for rfc.property-hooks
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/LVmAt on line 15 object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-07 03:27:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-06 20:13:19.003781" ["timezone_type"]=> int(3) ["timezone"]=> 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:
50.23 ms | 402 KiB | 8 Q