3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new \DateTimeImmutable('2021-01-01', new \DateTimeZone('Europe/Berlin')); $b = (clone $a); // $c = (clone $a)->setTimeZone(new \DateTimeZone('Europe/Paris')); // Same GMT offset but different timezone $d = (clone $a)->setTimeZone(new \DateTimeZone('Australia/Sydney')); // Different timezone $e = (clone $a)->modify('+1 second'); // Insufficient check assert($a == $b); assert($a == $c); assert($a == $d); assert($a != $e); // Check that accounts for timezone name (not just offset) assert($a->format('ce') === $b->format('ce')); assert($a->format('ce') !== $c->format('ce')); assert($a->format('ce') !== $d->format('ce')); assert($a->format('ce') !== $e->format('ce')); echo 'Done.';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k6Obe
function name:  (null)
number of ops:  105
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $5      'DateTimeImmutable'
          1        SEND_VAL_EX                                              '2021-01-01'
          2        NEW                                              $6      'DateTimeZone'
          3        SEND_VAL_EX                                              'Europe%2FBerlin'
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $6
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $5
    4     8        CLONE                                            ~10     !0
          9        ASSIGN                                                   !1, ~10
    5    10        CLONE                                            ~12     !0
         11        INIT_METHOD_CALL                                         ~12, 'setTimeZone'
         12        NEW                                              $13     'DateTimeZone'
         13        SEND_VAL_EX                                              'Europe%2FParis'
         14        DO_FCALL                                      0          
         15        SEND_VAR_NO_REF_EX                                       $13
         16        DO_FCALL                                      0  $15     
         17        ASSIGN                                                   !2, $15
    6    18        CLONE                                            ~17     !0
         19        INIT_METHOD_CALL                                         ~17, 'setTimeZone'
         20        NEW                                              $18     'DateTimeZone'
         21        SEND_VAL_EX                                              'Australia%2FSydney'
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $18
         24        DO_FCALL                                      0  $20     
         25        ASSIGN                                                   !3, $20
    7    26        CLONE                                            ~22     !0
         27        INIT_METHOD_CALL                                         ~22, 'modify'
         28        SEND_VAL_EX                                              '%2B1+second'
         29        DO_FCALL                                      0  $23     
         30        ASSIGN                                                   !4, $23
   10    31        ASSERT_CHECK                                             
         32        INIT_FCALL                                               'assert'
         33        IS_EQUAL                                         ~25     !0, !1
         34        SEND_VAL                                                 ~25
         35        SEND_VAL                                                 'assert%28%24a+%3D%3D+%24b%29'
         36        DO_ICALL                                                 
   11    37        ASSERT_CHECK                                             
         38        INIT_FCALL                                               'assert'
         39        IS_EQUAL                                         ~27     !0, !2
         40        SEND_VAL                                                 ~27
         41        SEND_VAL                                                 'assert%28%24a+%3D%3D+%24c%29'
         42        DO_ICALL                                                 
   12    43        ASSERT_CHECK                                             
         44        INIT_FCALL                                               'assert'
         45        IS_EQUAL                                         ~29     !0, !3
         46        SEND_VAL                                                 ~29
         47        SEND_VAL                                                 'assert%28%24a+%3D%3D+%24d%29'
         48        DO_ICALL                                                 
   13    49        ASSERT_CHECK                                             
         50        INIT_FCALL                                               'assert'
         51        IS_NOT_EQUAL                                     ~31     !0, !4
         52        SEND_VAL                                                 ~31
         53        SEND_VAL                                                 'assert%28%24a+%21%3D+%24e%29'
         54        DO_ICALL                                                 
   16    55        ASSERT_CHECK                                             
         56        INIT_FCALL                                               'assert'
         57        INIT_METHOD_CALL                                         !0, 'format'
         58        SEND_VAL_EX                                              'ce'
         59        DO_FCALL                                      0  $33     
         60        INIT_METHOD_CALL                                         !1, 'format'
         61        SEND_VAL_EX                                              'ce'
         62        DO_FCALL                                      0  $34     
         63        IS_IDENTICAL                                     ~35     $33, $34
         64        SEND_VAL                                                 ~35
         65        SEND_VAL                                                 'assert%28%24a-%3Eformat%28%27ce%27%29+%3D%3D%3D+%24b-%3Eformat%28%27ce%27%29%29'
         66        DO_ICALL                                                 
   17    67        ASSERT_CHECK                                             
         68        INIT_FCALL                                               'assert'
         69        INIT_METHOD_CALL                                         !0, 'format'
         70        SEND_VAL_EX                                              'ce'
         71        DO_FCALL                                      0  $37     
         72        INIT_METHOD_CALL                                         !2, 'format'
         73        SEND_VAL_EX                                              'ce'
         74        DO_FCALL                                      0  $38     
         75        IS_NOT_IDENTICAL                                 ~39     $37, $38
         76        SEND_VAL                                                 ~39
         77        SEND_VAL                                                 'assert%28%24a-%3Eformat%28%27ce%27%29+%21%3D%3D+%24c-%3Eformat%28%27ce%27%29%29'
         78        DO_ICALL                                                 
   18    79        ASSERT_CHECK                                             
         80        INIT_FCALL                                               'assert'
         81        INIT_METHOD_CALL                                         !0, 'format'
         82        SEND_VAL_EX                                              'ce'
         83        DO_FCALL                                      0  $41     
         84        INIT_METHOD_CALL                                         !3, 'format'
         85        SEND_VAL_EX                                              'ce'
         86        DO_FCALL                                      0  $42     
         87        IS_NOT_IDENTICAL                                 ~43     $41, $42
         88        SEND_VAL                                                 ~43
         89        SEND_VAL                                                 'assert%28%24a-%3Eformat%28%27ce%27%29+%21%3D%3D+%24d-%3Eformat%28%27ce%27%29%29'
         90        DO_ICALL                                                 
   19    91        ASSERT_CHECK                                             
         92        INIT_FCALL                                               'assert'
         93        INIT_METHOD_CALL                                         !0, 'format'
         94        SEND_VAL_EX                                              'ce'
         95        DO_FCALL                                      0  $45     
         96        INIT_METHOD_CALL                                         !4, 'format'
         97        SEND_VAL_EX                                              'ce'
         98        DO_FCALL                                      0  $46     
         99        IS_NOT_IDENTICAL                                 ~47     $45, $46
        100        SEND_VAL                                                 ~47
        101        SEND_VAL                                                 'assert%28%24a-%3Eformat%28%27ce%27%29+%21%3D%3D+%24e-%3Eformat%28%27ce%27%29%29'
        102        DO_ICALL                                                 
   21   103        ECHO                                                     'Done.'
        104      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.78 ms | 1019 KiB | 14 Q