3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public $str; function __construct($str) { $this->str = $str; } } class M extends B {} class C extends B {} function compare($a, $b) { $result = []; if ($a < $b) { $result[] = '<'; } if ($a > $b) { $result[] = '>'; } if ($a != $b) { $result[] = '!='; } if ($a == $b) { $result[] = '=='; } return $result; } assert(['=='] === compare(new C('A'), new C('A'))); assert(['<', '!='] === compare(new C('A'), new C('B'))); assert(['>', '!='] === compare(new C('Z'), new C('X'))); assert(['!='] === compare(new M('A'), new C('B'))); assert(['!='] === compare(new B('A'), new C('B'))); assert(['<', '!='] === compare(new M('A'), new M('B')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kVeDt
function name:  (null)
number of ops:  97
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSERT_CHECK                                             
          1        INIT_FCALL                                               'assert'
          2        INIT_FCALL                                               'compare'
          3        NEW                                              $0      'C'
          4        SEND_VAL_EX                                              'A'
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $0
          7        NEW                                              $2      'C'
          8        SEND_VAL_EX                                              'A'
          9        DO_FCALL                                      0          
         10        SEND_VAR                                                 $2
         11        DO_FCALL                                      0  $4      
         12        IS_IDENTICAL                                     ~5      $4, <array>
         13        SEND_VAL                                                 ~5
         14        SEND_VAL                                                 'assert%28%5B%27%3D%3D%27%5D+%3D%3D%3D+compare%28new+C%28%27A%27%29%2C+new+C%28%27A%27%29%29%29'
         15        DO_ICALL                                                 
   32    16        ASSERT_CHECK                                             
         17        INIT_FCALL                                               'assert'
         18        INIT_FCALL                                               'compare'
         19        NEW                                              $7      'C'
         20        SEND_VAL_EX                                              'A'
         21        DO_FCALL                                      0          
         22        SEND_VAR                                                 $7
         23        NEW                                              $9      'C'
         24        SEND_VAL_EX                                              'B'
         25        DO_FCALL                                      0          
         26        SEND_VAR                                                 $9
         27        DO_FCALL                                      0  $11     
         28        IS_IDENTICAL                                     ~12     $11, <array>
         29        SEND_VAL                                                 ~12
         30        SEND_VAL                                                 'assert%28%5B%27%3C%27%2C+%27%21%3D%27%5D+%3D%3D%3D+compare%28new+C%28%27A%27%29%2C+new+C%28%27B%27%29%29%29'
         31        DO_ICALL                                                 
   33    32        ASSERT_CHECK                                             
         33        INIT_FCALL                                               'assert'
         34        INIT_FCALL                                               'compare'
         35        NEW                                              $14     'C'
         36        SEND_VAL_EX                                              'Z'
         37        DO_FCALL                                      0          
         38        SEND_VAR                                                 $14
         39        NEW                                              $16     'C'
         40        SEND_VAL_EX                                              'X'
         41        DO_FCALL                                      0          
         42        SEND_VAR                                                 $16
         43        DO_FCALL                                      0  $18     
         44        IS_IDENTICAL                                     ~19     $18, <array>
         45        SEND_VAL                                                 ~19
         46        SEND_VAL                                                 'assert%28%5B%27%3E%27%2C+%27%21%3D%27%5D+%3D%3D%3D+compare%28new+C%28%27Z%27%29%2C+new+C%28%27X%27%29%29%29'
         47        DO_ICALL                                                 
   34    48        ASSERT_CHECK                                             
         49        INIT_FCALL                                               'assert'
         50        INIT_FCALL                                               'compare'
         51        NEW                                              $21     'M'
         52        SEND_VAL_EX                                              'A'
         53        DO_FCALL                                      0          
         54        SEND_VAR                                                 $21
         55        NEW                                              $23     'C'
         56        SEND_VAL_EX                                              'B'
         57        DO_FCALL                                      0          
         58        SEND_VAR                                                 $23
         59        DO_FCALL                                      0  $25     
         60        IS_IDENTICAL                                     ~26     $25, <array>
         61        SEND_VAL                                                 ~26
         62        SEND_VAL                                                 'assert%28%5B%27%21%3D%27%5D+%3D%3D%3D+compare%28new+M%28%27A%27%29%2C+new+C%28%27B%27%29%29%29'
         63        DO_ICALL                                                 
   35    64        ASSERT_CHECK                                             
         65        INIT_FCALL                                               'assert'
         66        INIT_FCALL                                               'compare'
         67        NEW                                              $28     'B'
         68        SEND_VAL_EX                                              'A'
         69        DO_FCALL                                      0          
         70        SEND_VAR                                                 $28
         71        NEW                                              $30     'C'
         72        SEND_VAL_EX                                              'B'
         73        DO_FCALL                                      0          
         74        SEND_VAR                                                 $30
         75        DO_FCALL                                      0  $32     
         76        IS_IDENTICAL                                     ~33     $32, <array>
         77        SEND_VAL                                                 ~33
         78        SEND_VAL                                                 'assert%28%5B%27%21%3D%27%5D+%3D%3D%3D+compare%28new+B%28%27A%27%29%2C+new+C%28%27B%27%29%29%29'
         79        DO_ICALL                                                 
   36    80        ASSERT_CHECK                                             
         81        INIT_FCALL                                               'assert'
         82        INIT_FCALL                                               'compare'
         83        NEW                                              $35     'M'
         84        SEND_VAL_EX                                              'A'
         85        DO_FCALL                                      0          
         86        SEND_VAR                                                 $35
         87        NEW                                              $37     'M'
         88        SEND_VAL_EX                                              'B'
         89        DO_FCALL                                      0          
         90        SEND_VAR                                                 $37
         91        DO_FCALL                                      0  $39     
         92        IS_IDENTICAL                                     ~40     $39, <array>
         93        SEND_VAL                                                 ~40
         94        SEND_VAL                                                 'assert%28%5B%27%3C%27%2C+%27%21%3D%27%5D+%3D%3D%3D+compare%28new+M%28%27A%27%29%2C+new+M%28%27B%27%29%29%29'
         95        DO_ICALL                                                 
         96      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 7
filename:       /in/kVeDt
function name:  compare
number of ops:  21
compiled vars:  !0 = $a, !1 = $b, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        ASSIGN                                                   !2, <array>
   16     3        IS_SMALLER                                               !0, !1
          4      > JMPZ                                                     ~4, ->7
   17     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  '%3C'
   19     7    >   IS_SMALLER                                               !1, !0
          8      > JMPZ                                                     ~6, ->11
   20     9    >   ASSIGN_DIM                                               !2
         10        OP_DATA                                                  '%3E'
   22    11    >   IS_NOT_EQUAL                                             !0, !1
         12      > JMPZ                                                     ~8, ->15
   23    13    >   ASSIGN_DIM                                               !2
         14        OP_DATA                                                  '%21%3D'
   25    15    >   IS_EQUAL                                                 !0, !1
         16      > JMPZ                                                     ~10, ->19
   26    17    >   ASSIGN_DIM                                               !2
         18        OP_DATA                                                  '%3D%3D'
   28    19    > > RETURN                                                   !2
   29    20*     > RETURN                                                   null

End of function compare

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kVeDt
function name:  __construct
number of ops:  4
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'str'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

End of class B.

Class M:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kVeDt
function name:  __construct
number of ops:  4
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'str'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

End of class M.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kVeDt
function name:  __construct
number of ops:  4
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'str'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.23 ms | 1017 KiB | 20 Q