3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static function noClosure() { echo 'Context of '.get_called_class().', no closure: '; echo Left::$prot; echo "\n"; } public static function withClosure() { echo 'Context of '.get_called_class().', with closure: '; $cl = function(){ echo Left::$prot; echo "\n"; }; $cl(); } } class Left extends Base { protected static $prot = 'works.'; } class Right extends Base { public static function direct() { echo 'Directly from Right: '; echo Left::$prot; echo "\n"; } } Right::direct(); Base::noClosure(); Right::noClosure(); Base::withClosure(); Right::withClosure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                  'Right', 'direct'
          1        DO_FCALL                                      0          
   33     2        INIT_STATIC_METHOD_CALL                                  'Base', 'noClosure'
          3        DO_FCALL                                      0          
   34     4        INIT_STATIC_METHOD_CALL                                  'Right', 'noClosure'
          5        DO_FCALL                                      0          
   36     6        INIT_STATIC_METHOD_CALL                                  'Base', 'withClosure'
          7        DO_FCALL                                      0          
   37     8        INIT_STATIC_METHOD_CALL                                  'Right', 'withClosure'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fh0Tth%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'prot'
          1        ECHO                                                     ~0
   13     2        ECHO                                                     '%0A'
   14     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fh0Tth%3A11%240

Class Base:
Function noclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  noClosure
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      'Context+of+', ~0
          2        CONCAT                                           ~2      ~1, '%2C+no+closure%3A+'
          3        ECHO                                                     ~2
    5     4        FETCH_STATIC_PROP_R          unknown             ~3      'prot'
          5        ECHO                                                     ~3
    6     6        ECHO                                                     '%0A'
    7     7      > RETURN                                                   null

End of function noclosure

Function withclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  withClosure
number of ops:  9
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   GET_CALLED_CLASS                                 ~1      
          1        CONCAT                                           ~2      'Context+of+', ~1
          2        CONCAT                                           ~3      ~2, '%2C+with+closure%3A+'
          3        ECHO                                                     ~3
   11     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0Tth%3A11%240'
          5        ASSIGN                                                   !0, ~4
   15     6        INIT_DYNAMIC_CALL                                        !0
          7        DO_FCALL                                      0          
   16     8      > RETURN                                                   null

End of function withclosure

End of class Base.

Class Left:
Function noclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  noClosure
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      'Context+of+', ~0
          2        CONCAT                                           ~2      ~1, '%2C+no+closure%3A+'
          3        ECHO                                                     ~2
    5     4        FETCH_STATIC_PROP_R          unknown             ~3      'prot'
          5        ECHO                                                     ~3
    6     6        ECHO                                                     '%0A'
    7     7      > RETURN                                                   null

End of function noclosure

Function withclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  withClosure
number of ops:  9
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   GET_CALLED_CLASS                                 ~1      
          1        CONCAT                                           ~2      'Context+of+', ~1
          2        CONCAT                                           ~3      ~2, '%2C+with+closure%3A+'
          3        ECHO                                                     ~3
   11     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0Tth%3A11%240'
          5        ASSIGN                                                   !0, ~4
   15     6        INIT_DYNAMIC_CALL                                        !0
          7        DO_FCALL                                      0          
   16     8      > RETURN                                                   null

End of function withclosure

End of class Left.

Class Right:
Function direct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  direct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                     'Directly+from+Right%3A+'
   26     1        FETCH_STATIC_PROP_R          unknown             ~0      'prot'
          2        ECHO                                                     ~0
   27     3        ECHO                                                     '%0A'
   28     4      > RETURN                                                   null

End of function direct

Function noclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  noClosure
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      'Context+of+', ~0
          2        CONCAT                                           ~2      ~1, '%2C+no+closure%3A+'
          3        ECHO                                                     ~2
    5     4        FETCH_STATIC_PROP_R          unknown             ~3      'prot'
          5        ECHO                                                     ~3
    6     6        ECHO                                                     '%0A'
    7     7      > RETURN                                                   null

End of function noclosure

Function withclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h0Tth
function name:  withClosure
number of ops:  9
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   GET_CALLED_CLASS                                 ~1      
          1        CONCAT                                           ~2      'Context+of+', ~1
          2        CONCAT                                           ~3      ~2, '%2C+with+closure%3A+'
          3        ECHO                                                     ~3
   11     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh0Tth%3A11%240'
          5        ASSIGN                                                   !0, ~4
   15     6        INIT_DYNAMIC_CALL                                        !0
          7        DO_FCALL                                      0          
   16     8      > RETURN                                                   null

End of function withclosure

End of class Right.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.7 ms | 1407 KiB | 13 Q