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; })(...$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/GDahs
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

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/GDahs
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                          ~2      [0]
   11     2        INIT_DYNAMIC_CALL                                        ~2
          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


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GDahs
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 Dynamic Function 0

End of function __construct

End of class Train.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.93 ms | 1446 KiB | 14 Q