3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); class a { public function b(&$name, $junk) { $name = strtolower($name).$junk; } } $name = 'Rasmus'; $junk = 'junk'; $arguments = [$name, $junk]; $obj = new a; $reflectionMethod = new ReflectionMethod('a', 'b'); $closure = $reflectionMethod->getClosure($obj); $closure(...$arguments); echo $arguments[0];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tQFjp
function name:  (null)
number of ops:  27
compiled vars:  !0 = $name, !1 = $junk, !2 = $arguments, !3 = $obj, !4 = $reflectionMethod, !5 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
   11     3        ASSIGN                                                   !0, 'Rasmus'
   12     4        ASSIGN                                                   !1, 'junk'
   13     5        INIT_ARRAY                                       ~9      !0
          6        ADD_ARRAY_ELEMENT                                ~9      !1
          7        ASSIGN                                                   !2, ~9
   14     8        NEW                                              $11     'a'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $11
   15    11        NEW                                              $14     'ReflectionMethod'
         12        SEND_VAL_EX                                              'a'
         13        SEND_VAL_EX                                              'b'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !4, $14
   16    16        INIT_METHOD_CALL                                         !4, 'getClosure'
         17        SEND_VAR_EX                                              !3
         18        DO_FCALL                                      0  $17     
         19        ASSIGN                                                   !5, $17
   17    20        INIT_DYNAMIC_CALL                                        !5
         21        SEND_UNPACK                                              !2
         22        CHECK_UNDEF_ARGS                                         
         23        DO_FCALL                                      1          
   18    24        FETCH_DIM_R                                      ~20     !2, 0
         25        ECHO                                                     ~20
         26      > RETURN                                                   1

Class a:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tQFjp
function name:  b
number of ops:  8
compiled vars:  !0 = $name, !1 = $junk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        CONCAT                                           ~3      $2, !1
          6        ASSIGN                                                   !0, ~3
    7     7      > RETURN                                                   null

End of function b

End of class a.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.72 ms | 1396 KiB | 17 Q