3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a; public function call($call) { $call->bindTo($this, $this); return call_user_func($call); } } $a = new A; $a->a = 'Foo'; echo $a->call(function () { return $this->a; } );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0cTsB
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   13     3        ASSIGN_OBJ                                               !0, 'a'
          4        OP_DATA                                                  'Foo'
   15     5        INIT_METHOD_CALL                                         !0, 'call'
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0cTsB%3A15%240'
          7        SEND_VAL_EX                                              ~5
          8        DO_FCALL                                      0  $6      
          9        ECHO                                                     $6
         10      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F0cTsB%3A15%240

Class A:
Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0cTsB
function name:  call
number of ops:  11
compiled vars:  !0 = $call
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_METHOD_CALL                                         !0, 'bindTo'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        FETCH_THIS                                       $2      
          5        SEND_VAR_EX                                              $2
          6        DO_FCALL                                      0          
    8     7        INIT_USER_CALL                                0          'call_user_func', !0
          8        DO_FCALL                                      0  $4      
          9      > RETURN                                                   $4
    9    10*     > RETURN                                                   null

End of function call

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.81 ms | 1395 KiB | 13 Q