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) { }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/LVmAt
function name:  (null)
number of ops:  32
compiled vars:  !0 = $user_date_str, !1 = $user_tz, !2 = $server_tz, !3 = $user_datetime, !4 = $server_datetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2015%2F11%2F06+19%3A27%3A21'
    4     1        ASSIGN                                                   !1, 'America%2FLos_Angeles'
    5     2        ASSIGN                                                   !2, 'UTC'
    8     3        NEW                                              $8      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        NEW                                              $9      'DateTimeZone'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $9
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $8
   10    11        INIT_METHOD_CALL                                         !3, 'setTimeZone'
         12        NEW                                              $13     'DateTimeZone'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
         15        SEND_VAR_NO_REF_EX                                       $13
         16        DO_FCALL                                      0          
   15    17        NEW                                              $16     'DateTime'
         18        SEND_VAL_EX                                              null
         19        NEW                                              $17     'DateTimeZone'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $17
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !4, $16
   17    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                                 
   19    29        IS_SMALLER                                               !3, !4
         30      > JMPZ                                                     ~22, ->31
   21    31    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.32 ms | 1396 KiB | 15 Q