3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public $a; } class B extends A { public $b; } $a = new B(); $a->a = 0; $a->b = 1; $b = new B(); $b->a = 1; $b->b = 0; // This compare walks the properties_table in both objects directly, // resulting in ->a being compared first. // // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1517 var_dump($a < $b); // print_r() (or several other potential actions) forces the properties HashTable to be materialized, // It's not the output of this that matters, so ignore it. print_r($a, true); // Now that one of the objects has a materialized HashTable, // we materialize the other and walk that instead. // However, ordering of properties in properties_info // is not (necessarily) the same as in the property slots. // // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1569 // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L70 var_dump($a < $b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NLZNm
function name:  (null)
number of ops:  27
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   NEW                                                  $2      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
          3        ASSIGN_OBJ                                                   !0, 'a'
          4        OP_DATA                                                      0
          5        ASSIGN_OBJ                                                   !0, 'b'
          6        OP_DATA                                                      1
    6     7        NEW                                                  $7      'B'
          8        DO_FCALL                                          0          
          9        ASSIGN                                                       !1, $7
         10        ASSIGN_OBJ                                                   !1, 'a'
         11        OP_DATA                                                      1
         12        ASSIGN_OBJ                                                   !1, 'b'
         13        OP_DATA                                                      0
   12    14        INIT_FCALL                                                   'var_dump'
         15        IS_SMALLER                                           ~12     !0, !1
         16        SEND_VAL                                                     ~12
         17        DO_ICALL                                                     
   16    18        INIT_FCALL                                                   'print_r'
         19        SEND_VAR                                                     !0
         20        SEND_VAL                                                     <true>
         21        DO_ICALL                                                     
   25    22        INIT_FCALL                                                   'var_dump'
         23        IS_SMALLER                                           ~15     !0, !1
         24        SEND_VAL                                                     ~15
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.93 ms | 3297 KiB | 15 Q