3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Car { private $color; private $size; public function __construct($color, $size) { $this->color = $color; $this->size = $size; } public function describe() { return "A $this->size $this->color car."; } } $callable = [new \ReflectionClass('Car'), 'newInstance']; $cars = []; $cars[] = call_user_func($callable, 'red', 'big')->describe(); $cars[] = call_user_func_array($callable, ['blue', 'small'])->describe(); var_export($cars);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7fvQL
function name:  (null)
number of ops:  27
compiled vars:  !0 = $callable, !1 = $cars
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $2      'ReflectionClass'
          1        SEND_VAL_EX                                                  'Car'
          2        DO_FCALL                                          0          
          3        INIT_ARRAY                                           ~4      $2
          4        ADD_ARRAY_ELEMENT                                    ~4      'newInstance'
          5        ASSIGN                                                       !0, ~4
   17     6        ASSIGN                                                       !1, <array>
   18     7        INIT_USER_CALL                                    2          'call_user_func', !0
          8        SEND_USER                                                    'red'
          9        SEND_USER                                                    'big'
         10        DO_FCALL                                          0  $8      
         11        INIT_METHOD_CALL                                             $8, 'describe'
         12        DO_FCALL                                          0  $9      
         13        ASSIGN_DIM                                                   !1
         14        OP_DATA                                                      $9
   19    15        INIT_USER_CALL                                    0          'call_user_func_array', !0
         16        SEND_ARRAY                                                   <array>
         17        CHECK_UNDEF_ARGS                                             
         18        DO_FCALL                                          1  $11     
         19        INIT_METHOD_CALL                                             $11, 'describe'
         20        DO_FCALL                                          0  $12     
         21        ASSIGN_DIM                                                   !1
         22        OP_DATA                                                      $12
   22    23        INIT_FCALL                                                   'var_export'
         24        SEND_VAR                                                     !1
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Class Car:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7fvQL
function name:  __construct
number of ops:  7
compiled vars:  !0 = $color, !1 = $size
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    7     2        ASSIGN_OBJ                                                   'color'
          3        OP_DATA                                                      !0
    8     4        ASSIGN_OBJ                                                   'size'
          5        OP_DATA                                                      !1
    9     6      > RETURN                                                       null

End of function __construct

Function describe:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7fvQL
function name:  describe
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ROPE_INIT                                         5  ~3      'A+'
          1        FETCH_OBJ_R                                          ~0      'size'
          2        ROPE_ADD                                          1  ~3      ~3, ~0
          3        ROPE_ADD                                          2  ~3      ~3, '+'
          4        FETCH_OBJ_R                                          ~1      'color'
          5        ROPE_ADD                                          3  ~3      ~3, ~1
          6        ROPE_END                                          4  ~2      ~3, '+car.'
          7      > RETURN                                                       ~2
   12     8*     > RETURN                                                       null

End of function describe

End of class Car.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.48 ms | 2077 KiB | 14 Q