3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function foo($var) { $static = &$var; return $static; } public function __destruct() { return 'die'; } } $test = new Test; $test->foo(); $var1 = call_user_func(array($test, 'foo')); $var2 = call_user_func(array(&$test, 'foo')); var_dump($var1, $var2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xf4me
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test, !1 = $var1, !2 = $var2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   17     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
   19     5        INIT_ARRAY                                       ~7      !0
          6        ADD_ARRAY_ELEMENT                                ~7      'foo'
          7        INIT_USER_CALL                                0          'call_user_func', ~7
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !1, $8
   21    10        INIT_ARRAY                                       ~10     !0
         11        ADD_ARRAY_ELEMENT                                ~10     'foo'
         12        INIT_USER_CALL                                0          'call_user_func', ~10
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !2, $11
   22    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class Test:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xf4me
function name:  foo
number of ops:  4
compiled vars:  !0 = $var, !1 = $static
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_REF                                               !1, !0
    7     2      > RETURN                                                   !1
    8     3*     > RETURN                                                   null

End of function foo

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xf4me
function name:  __destruct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   'die'
   12     1*     > RETURN                                                   null

End of function __destruct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.94 ms | 1396 KiB | 15 Q