3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $priv = 1; protected $prot = 2; public $pub = 3; public function test() { $obj = $this; return function () use ($obj) { echo $obj->priv; echo $obj->prot; echo $obj->pub; }; } } $a = new A(); $call = $a->test(); call_user_func($call);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ctHJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a, !1 = $call
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   23     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   26     6        INIT_USER_CALL                                0          'call_user_func', !1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0ctHJ%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ctHJ
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   BIND_STATIC                                              !0
   14     1        FETCH_OBJ_R                                      ~1      !0, 'priv'
          2        ECHO                                                     ~1
   15     3        FETCH_OBJ_R                                      ~2      !0, 'prot'
          4        ECHO                                                     ~2
   16     5        FETCH_OBJ_R                                      ~3      !0, 'pub'
          6        ECHO                                                     ~3
   17     7      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0ctHJ%3A13%240

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ctHJ
function name:  test
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_THIS                                       ~1      
          1        ASSIGN                                                   !0, ~1
   13     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0ctHJ%3A13%240'
          3        BIND_LEXICAL                                             ~3, !0
   17     4      > RETURN                                                   ~3
   18     5*     > RETURN                                                   null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.9 ms | 1395 KiB | 13 Q