3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (version_compare(PHP_VERSION, '5.4.0', '<')) { echo 'Skip, no closures support'; return; } class Base { public static function hi() { $cl = function(){ echo Left::$prot; }; $cl(); } } class Left extends Base { protected static $prot = "Hello, world!\n"; } class Right extends Base { } Base::hi(); Right::hi();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MWXtb
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'version_compare'
          1        SEND_VAL                                                 '8.0.0'
          2        SEND_VAL                                                 '5.4.0'
          3        SEND_VAL                                                 '%3C'
          4        DO_ICALL                                         $0      
          5      > JMPZ                                                     $0, ->8
    3     6    >   ECHO                                                     'Skip%2C+no+closures+support'
    4     7      > RETURN                                                   null
   24     8    >   INIT_STATIC_METHOD_CALL                                  'Base', 'hi'
          9        DO_FCALL                                      0          
   26    10        INIT_STATIC_METHOD_CALL                                  'Right', 'hi'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FMWXtb%3A10%240

Class Base:
Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MWXtb
function name:  hi
number of ops:  5
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMWXtb%3A10%240'
          1        ASSIGN                                                   !0, ~1
   13     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   14     4      > RETURN                                                   null

End of function hi

End of class Base.

Class Left:
Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MWXtb
function name:  hi
number of ops:  5
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMWXtb%3A10%240'
          1        ASSIGN                                                   !0, ~1
   13     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   14     4      > RETURN                                                   null

End of function hi

End of class Left.

Class Right:
Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MWXtb
function name:  hi
number of ops:  5
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMWXtb%3A10%240'
          1        ASSIGN                                                   !0, ~1
   13     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   14     4      > RETURN                                                   null

End of function hi

End of class Right.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.68 ms | 1392 KiB | 15 Q