3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const A = 1; public function bar() { return function() { return function() { var_dump(static::A, self::A); }; }; } } class Herp extends Foo { const A=2; } $f = (new Herp())->bar(); $f = $f(); $f(); (new Herp())->bar()()();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rQlU6
function name:  (null)
number of ops:  19
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Herp'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $1, 'bar'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
   18     5        INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !0, $5
   19     8        INIT_DYNAMIC_CALL                                        !0
          9        DO_FCALL                                      0          
   20    10        NEW                                              $8      'Herp'
         11        DO_FCALL                                      0          
         12        INIT_METHOD_CALL                                         $8, 'bar'
         13        DO_FCALL                                      0  $10     
         14        INIT_DYNAMIC_CALL                                        $10
         15        DO_FCALL                                      0  $11     
         16        INIT_DYNAMIC_CALL                                        $11
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FrQlU6%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rQlU6
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrQlU6%3A6%241'
    8     1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrQlU6%3A5%240

Function %00%7Bclosure%7D%2Fin%2FrQlU6%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rQlU6
function name:  {closure}
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS_CONSTANT                             ~0      'A'
          2        SEND_VAL                                                 ~0
          3        FETCH_CLASS_CONSTANT                             ~1      'A'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
    8     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrQlU6%3A6%241

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rQlU6
function name:  bar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrQlU6%3A5%240'
    9     1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function bar

End of class Foo.

Class Herp:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rQlU6
function name:  bar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrQlU6%3A5%240'
    9     1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function bar

End of class Herp.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.78 ms | 1400 KiB | 15 Q