3v4l.org

run code in 300+ PHP versions simultaneously
<?php $closure = function() { echo $this->private_property; }; class MyClass { private $private_property = 'wut?'; public function callClosure($closure) { $closure(); } } $obj = new MyClass; $obj->callClosure($closure);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJ1L3
function name:  (null)
number of ops:  9
compiled vars:  !0 = $closure, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLJ1L3%3A3%240'
          1        ASSIGN                                                   !0, ~2
   17     2        NEW                                              $4      'MyClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   18     5        INIT_METHOD_CALL                                         !1, 'callClosure'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

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

Class MyClass:
Function callclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJ1L3
function name:  callClosure
number of ops:  4
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0          
   14     3      > RETURN                                                   null

End of function callclosure

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.64 ms | 1398 KiB | 13 Q