3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a() { $f = function() { return get_called_class(); }; return $f(); } class A { protected $a; public function foo() { function () { set_error_handler(function() {}); $class = get_called_class(); restore_error_handler(); return $class; }; $f = function() { echo a(); }; $f(); } } $a = new A; $a->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qODV
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

End of function a

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

End of function %00%7Bclosure%7D%2Fin%2F2qODV%3A3%240

Function %00%7Bclosure%7D%2Fin%2F2qODV%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qODV
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2qODV%3A11%242'
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   12     4        GET_CALLED_CLASS                                 ~3      
          5        ASSIGN                                                   !0, ~3
   13     6        INIT_FCALL                                               'restore_error_handler'
          7        DO_ICALL                                                 
   15     8      > RETURN                                                   !0
   16     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2qODV%3A10%241

Function %00%7Bclosure%7D%2Fin%2F2qODV%3A11%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qODV
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2qODV%3A11%242

Function %00%7Bclosure%7D%2Fin%2F2qODV%3A18%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qODV
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'a'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   21     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2qODV%3A18%243

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2qODV
function name:  foo
number of ops:  7
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2qODV%3A10%241'
   16     1        FREE                                                     ~1
   18     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2qODV%3A18%243'
          3        ASSIGN                                                   !0, ~2
   23     4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0          
   24     6      > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.5 ms | 1403 KiB | 18 Q