3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $data = 'abc'; public function myMethod() { echo "data: " . $this->data; } public function getCallBack() { return [$this, "myMethod"]; } } $obj = new MyClass; $callBack = $obj->getCallBack(); call_user_func($callBack);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fMs28
function name:  (null)
number of ops:  9
compiled vars:  !0 = $obj, !1 = $callBack
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   17     3        INIT_METHOD_CALL                                         !0, 'getCallBack'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   19     6        INIT_USER_CALL                                0          'call_user_func', !1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class MyClass:
Function mymethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fMs28
function name:  myMethod
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'data'
          1        CONCAT                                           ~1      'data%3A+', ~0
          2        ECHO                                                     ~1
    8     3      > RETURN                                                   null

End of function mymethod

Function getcallback:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fMs28
function name:  getCallBack
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_THIS                                       ~0      
          1        INIT_ARRAY                                       ~1      ~0
          2        ADD_ARRAY_ELEMENT                                ~1      'myMethod'
          3      > RETURN                                                   ~1
   12     4*     > RETURN                                                   null

End of function getcallback

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.81 ms | 1394 KiB | 13 Q