3v4l.org

run code in 500+ PHP versions simultaneously
<?php function test_func_get_args() { var_dump(func_get_args()); // as expected } function test_array_slice($array) { var_dump(array_slice($array, 1)); // as expected } function test_array_slice_with_func_get_args() { var_dump(array_slice(func_get_args(), 1)); // ??? } $input = [1, 2, 3]; echo "=-=-=-= TEST func_get_args() =-=-=-=\n"; test_func_get_args(...$input); echo "\n=-=-=-= TEST array_slice() =-=-=-=\n"; test_array_slice($input); echo "\n=-=-=-= TEST 3 =-=-=-=\n"; test_array_slice_with_func_get_args(...$input);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSFoM
function name:  (null)
number of ops:  16
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                       !0, <array>
   17     1        ECHO                                                         '%3D-%3D-%3D-%3D+TEST+func_get_args%28%29+%3D-%3D-%3D-%3D%0A'
   18     2        INIT_FCALL                                                   'test_func_get_args'
          3        SEND_UNPACK                                                  !0
          4        CHECK_UNDEF_ARGS                                             
          5        DO_FCALL                                          0          
   20     6        ECHO                                                         '%0A%3D-%3D-%3D-%3D+TEST+array_slice%28%29+%3D-%3D-%3D-%3D%0A'
   21     7        INIT_FCALL                                                   'test_array_slice'
          8        SEND_VAR                                                     !0
          9        DO_FCALL                                          0          
   23    10        ECHO                                                         '%0A%3D-%3D-%3D-%3D+TEST+3+%3D-%3D-%3D-%3D%0A'
   24    11        INIT_FCALL                                                   'test_array_slice_with_func_get_args'
         12        SEND_UNPACK                                                  !0
         13        CHECK_UNDEF_ARGS                                             
         14        DO_FCALL                                          0          
         15      > RETURN                                                       1

Function test_func_get_args:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSFoM
function name:  test_func_get_args
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                                   'var_dump'
          1        FUNC_GET_ARGS                                        ~0      
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                                     
    5     4      > RETURN                                                       null

End of function test_func_get_args

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

End of function test_array_slice

Function test_array_slice_with_func_get_args:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSFoM
function name:  test_array_slice_with_func_get_args
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'var_dump'
          1        FUNC_GET_ARGS                                        ~0      1
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                                     
   13     4      > RETURN                                                       null

End of function test_array_slice_with_func_get_args

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
411.84 ms | 2191 KiB | 18 Q