3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a = "Hello"; public function saySomething(){ echo $this->a; } } $func = function($a) { $this->a = $a; }; $obj = new A(); $func = Closure::bind($func, $obj, $obj); $func("Worked"); $obj->saySomething();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZZkSW
function name:  (null)
number of ops:  17
compiled vars:  !0 = $func, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZZkSW%3A12%240'
          1        ASSIGN                                                   !0, ~2
   15     2        NEW                                              $4      'A'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   16     5        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $7      
         10        ASSIGN                                                   !0, $7
   17    11        INIT_DYNAMIC_CALL                                        !0
         12        SEND_VAL_EX                                              'Worked'
         13        DO_FCALL                                      0          
   18    14        INIT_METHOD_CALL                                         !1, 'saySomething'
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FZZkSW%3A12%240

Class A:
Function saysomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZZkSW
function name:  saySomething
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1        ECHO                                                     ~0
    9     2      > RETURN                                                   null

End of function saysomething

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.08 ms | 1395 KiB | 13 Q