3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data['slider'] = [1,2,3,4,5,6,7,8,9]; $sliced_array = array_slice($data["slider"], 0, 3); var_export($sliced_array); // preserving the keys is useless echo "\n***\n"; // Shuffle the keys and loop through them to create a new, randomized array of images. shuffle($sliced_array); var_export($sliced_array); // reordered elements are reindexed echo "\n***\n"; $data['slider'] = $sliced_array + array_slice($data["slider"], 0); // starting slice from zero is the default, so the parameter is not needed var_export($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jCmfr
function name:  (null)
number of ops:  32
compiled vars:  !0 = $data, !1 = $sliced_array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                                   !0, 'slider'
          1        OP_DATA                                                      <array>
    4     2        INIT_FCALL                                                   'array_slice'
          3        FETCH_DIM_R                                          ~3      !0, 'slider'
          4        SEND_VAL                                                     ~3
          5        SEND_VAL                                                     0
          6        SEND_VAL                                                     3
          7        DO_ICALL                                             $4      
          8        ASSIGN                                                       !1, $4
    5     9        INIT_FCALL                                                   'var_export'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                                     
    6    12        ECHO                                                         '%0A%2A%2A%2A%0A'
    8    13        INIT_FCALL                                                   'shuffle'
         14        SEND_REF                                                     !1
         15        DO_ICALL                                                     
    9    16        INIT_FCALL                                                   'var_export'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                                     
   10    19        ECHO                                                         '%0A%2A%2A%2A%0A'
   12    20        INIT_FCALL                                                   'array_slice'
         21        FETCH_DIM_R                                          ~10     !0, 'slider'
         22        SEND_VAL                                                     ~10
         23        SEND_VAL                                                     0
         24        DO_ICALL                                             $11     
         25        ADD                                                  ~12     !1, $11
         26        ASSIGN_DIM                                                   !0, 'slider'
         27        OP_DATA                                                      ~12
   14    28        INIT_FCALL                                                   'var_export'
         29        SEND_VAR                                                     !0
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.94 ms | 1755 KiB | 16 Q