3v4l.org

run code in 500+ 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 { } 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/O5dLF
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   INIT_STATIC_METHOD_CALL                                      'Base', 'noClosure'
          1        DO_FCALL                                          0          
   27     2        INIT_STATIC_METHOD_CALL                                      'Right', 'noClosure'
          3        DO_FCALL                                          0          
   29     4        INIT_STATIC_METHOD_CALL                                      'Base', 'withClosure'
          5        DO_FCALL                                          0          
   30     6        INIT_STATIC_METHOD_CALL                                      'Right', 'withClosure'
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Class Base:
Function noclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5dLF
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/O5dLF
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                              ~4      [0]
          5        ASSIGN                                                       !0, ~4
   15     6        INIT_DYNAMIC_CALL                                            !0
          7        DO_FCALL                                          0          
   16     8      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5dLF
function name:  {closure:Base::withClosure():11}
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 Dynamic Function 0

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/O5dLF
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/O5dLF
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                              ~4      [0]
          5        ASSIGN                                                       !0, ~4
   15     6        INIT_DYNAMIC_CALL                                            !0
          7        DO_FCALL                                          0          
   16     8      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5dLF
function name:  {closure:Base::withClosure():11}
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 Dynamic Function 0

End of function withclosure

End of class Left.

Class Right:
Function noclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5dLF
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/O5dLF
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                              ~4      [0]
          5        ASSIGN                                                       !0, ~4
   15     6        INIT_DYNAMIC_CALL                                            !0
          7        DO_FCALL                                          0          
   16     8      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5dLF
function name:  {closure:Base::withClosure():11}
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 Dynamic Function 0

End of function withclosure

End of class Right.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
214.32 ms | 2493 KiB | 8 Q