3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private function privateMethod() { return 'caught'; } public function publicMethod() { $c = function() { return $this->privateMethod(); }; $c = $c->bindTo($this); $c(); } }; $obj = new Test; $obj->publicMethod();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dfler
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'publicMethod'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FDfler%3A11%240

Class Test:
Function privatemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dfler
function name:  privateMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'caught'
    7     1*     > RETURN                                                   null

End of function privatemethod

Function publicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dfler
function name:  publicMethod
number of ops:  10
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDfler%3A11%240'
          1        ASSIGN                                                   !0, ~1
   15     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        FETCH_THIS                                       $3      
          4        SEND_VAR_EX                                              $3
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !0, $4
   16     7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0          
   17     9      > RETURN                                                   null

End of function publicmethod

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.25 ms | 1395 KiB | 13 Q