3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create two identical DateTime objects $a = new DateTime("2015-02-01 00:00:00", new DateTimeZone("PST")); $b = clone $a; // They should be equal (and they are) compare($a, $b); // Now change the timezone to EST. $b->setTimezone(new DateTimeZone("EST")); //The actual timestamp should not change (it does not in PHP 5.4) so $a should still be equal to $b, but it will say $a > $b. compare($a, $b); function compare($a, $b) { var_dump($a); var_dump($b); echo ($a > $b ? '$a > $b' : ($a < $b ? '$a < $b' : ($a == $b ? '$a == $b' : 'undefined'))) . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dTOrf
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $2      'DateTime'
          1        SEND_VAL_EX                                              '2015-02-01+00%3A00%3A00'
          2        NEW                                              $3      'DateTimeZone'
          3        SEND_VAL_EX                                              'PST'
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $2
    5     8        CLONE                                            ~7      !0
          9        ASSIGN                                                   !1, ~7
    7    10        INIT_FCALL_BY_NAME                                       'compare'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
    9    14        INIT_METHOD_CALL                                         !1, 'setTimezone'
         15        NEW                                              $10     'DateTimeZone'
         16        SEND_VAL_EX                                              'EST'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $10
         19        DO_FCALL                                      0          
   11    20        INIT_FCALL_BY_NAME                                       'compare'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0          
   17    24      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dTOrf
function name:  compare
number of ops:  26
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   16     8        IS_SMALLER                                               !1, !0
          9      > JMPZ                                                     ~4, ->12
         10    >   QM_ASSIGN                                        ~5      '%24a+%3E+%24b'
         11      > JMP                                                      ->23
         12    >   IS_SMALLER                                               !0, !1
         13      > JMPZ                                                     ~6, ->16
         14    >   QM_ASSIGN                                        ~7      '%24a+%3C+%24b'
         15      > JMP                                                      ->22
         16    >   IS_EQUAL                                                 !0, !1
         17      > JMPZ                                                     ~8, ->20
         18    >   QM_ASSIGN                                        ~9      '%24a+%3D%3D+%24b'
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~9      'undefined'
         21    >   QM_ASSIGN                                        ~7      ~9
         22    >   QM_ASSIGN                                        ~5      ~7
         23    >   CONCAT                                           ~10     ~5, '%0A'
         24        ECHO                                                     ~10
   17    25      > RETURN                                                   null

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.43 ms | 1400 KiB | 15 Q