3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [0, 1, 2, 3]; unset($x[0]); // There's no index 0. function foo(...$arg) { var_dump($arg); } foo(...$x); // Yet no errors or nothing: [0 => 1, 1 => 2, 2 => 3] $y = [0, 1]; $y[3] = 3; // Adding elements out of order. $y[2] = 2; var_dump($y); // Out of order: [0 => 0, 1 => 1, 3 => 3, 2 => 2] foo(...$y); // Uses the order, not the indexes: [0 => 0, 1 => 1, 2 => 3, 3 => 2]
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FU5Ia
function name:  (null)
number of ops:  19
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        UNSET_DIM                                                !0, 0
   11     2        INIT_FCALL                                               'foo'
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1          
   13     6        ASSIGN                                                   !1, <array>
   15     7        ASSIGN_DIM                                               !1, 3
          8        OP_DATA                                                  3
   16     9        ASSIGN_DIM                                               !1, 2
         10        OP_DATA                                                  2
   18    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'foo'
         15        SEND_UNPACK                                              !1
         16        CHECK_UNDEF_ARGS                                         
         17        DO_FCALL                                      1          
         18      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FU5Ia
function name:  foo
number of ops:  5
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_VARIADIC                                    !0      
    8     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    9     4      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.99 ms | 1402 KiB | 17 Q