3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array("a", "b", "c", "d", "e"); $output = array_slice($input, 2); // returns "c", "d", and "e" $output = array_slice($input, -2, 1); // returns "d" $output = array_slice($input, 0, 3); // returns "a", "b", and "c" // note the differences in the array keys print_r(array_slice($input,0,4));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EtHZm
function name:  (null)
number of ops:  27
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'array_slice'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    5     6        INIT_FCALL                                               'array_slice'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 -2
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !1, $5
    6    12        INIT_FCALL                                               'array_slice'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 3
         16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !1, $7
    9    18        INIT_FCALL                                               'print_r'
         19        INIT_FCALL                                               'array_slice'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 0
         22        SEND_VAL                                                 4
         23        DO_ICALL                                         $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.74 ms | 1395 KiB | 17 Q