3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { protected $test = '1'; public function __construct(){ $a = function(){ var_dump($this); }; $a(); } public function xx($callback){ $callback(); } } $a = new X(); $a->xx(function(){ var_dump($this); });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9WtIr
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_METHOD_CALL                                         !0, 'xx'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9WtIr%3A25%241'
   27     5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F9WtIr%3A9%240

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

End of function %00%7Bclosure%7D%2Fin%2F9WtIr%3A25%241

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

End of function __construct

Function xx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9WtIr
function name:  xx
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0          
   19     3      > RETURN                                                   null

End of function xx

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.36 ms | 1400 KiB | 15 Q