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() { echo set_error_handler(function() {}) && get_called_class() && restore_error_handler(); $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/lRmUj
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     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/lRmUj
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%2FlRmUj%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%2FlRmUj%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lRmUj
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%2FlRmUj%3A3%240

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

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

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

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

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

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.36 ms | 1407 KiB | 18 Q