3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Wagon {} class Train { public function __construct(array $wagons) { $this->wagons = (function (Wagon ...$wagons) { return $wagons; })->__invoke(...$wagons); } } var_dump(new Train([new Wagon, new Wagon, new Wagon]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBR8i
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Train'
          2        NEW                                              $1      'Wagon'
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~3      $1
          5        NEW                                              $4      'Wagon'
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~3      $4
          8        NEW                                              $6      'Wagon'
          9        DO_FCALL                                      0          
         10        ADD_ARRAY_ELEMENT                                ~3      $6
         11        SEND_VAL_EX                                              ~3
         12        DO_FCALL                                      0          
         13        SEND_VAR                                                 $0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FGBR8i%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBR8i
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $wagons
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_VARIADIC                                    !0      
   10     1      > RETURN                                                   !0
   11     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGBR8i%3A9%240

Class Wagon: [no user functions]
Class Train:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBR8i
function name:  __construct
number of ops:  9
compiled vars:  !0 = $wagons
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGBR8i%3A9%240'
   11     2        INIT_METHOD_CALL                                         ~2, '__invoke'
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $3      
    9     6        ASSIGN_OBJ                                               'wagons'
   11     7        OP_DATA                                                  $3
   12     8      > RETURN                                                   null

End of function __construct

End of class Train.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.98 ms | 1396 KiB | 15 Q