3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { $foo = static function() { var_dump(get_called_class()); }; $foo(); } public static function baz() { $foo = function() { var_dump(get_called_class()); }; $foo(); } } class Bar extends Foo { } Bar::bar(); Bar::baz();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sTPeE
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_STATIC_METHOD_CALL                                  'Bar', 'bar'
          1        DO_FCALL                                      0          
   26     2        INIT_STATIC_METHOD_CALL                                  'Bar', 'baz'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

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

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

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

End of function %00%7Bclosure%7D%2Fin%2FsTPeE%3A12%241

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

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sTPeE
function name:  baz
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsTPeE%3A12%241'
          1        ASSIGN                                                   !0, ~1
   16     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   17     4      > RETURN                                                   null

End of function baz

End of class Foo.

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

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sTPeE
function name:  baz
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsTPeE%3A12%241'
          1        ASSIGN                                                   !0, ~1
   16     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   17     4      > RETURN                                                   null

End of function baz

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.94 ms | 1400 KiB | 15 Q