3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth']; shuffle($data); $result = [[$data[0], $data[count($data)-1]]]; for($i=0; $i<count($data)-1; $i++) { $result[] = [$data[$i], $data[$i+1]]; } var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
Branch analysis from position: 14
filename:       /in/ce41t
function name:  (null)
number of ops:  30
compiled vars:  !0 = $data, !1 = $result, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'shuffle'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    5     4        FETCH_DIM_R                                      ~5      !0, 0
          5        INIT_ARRAY                                       ~6      ~5
          6        COUNT                                            ~7      !0
          7        SUB                                              ~8      ~7, 1
          8        FETCH_DIM_R                                      ~9      !0, ~8
          9        ADD_ARRAY_ELEMENT                                ~6      ~9
         10        INIT_ARRAY                                       ~10     ~6
         11        ASSIGN                                                   !1, ~10
    6    12        ASSIGN                                                   !2, 0
         13      > JMP                                                      ->22
    8    14    >   FETCH_DIM_R                                      ~14     !0, !2
         15        INIT_ARRAY                                       ~15     ~14
         16        ADD                                              ~16     !2, 1
         17        FETCH_DIM_R                                      ~17     !0, ~16
         18        ADD_ARRAY_ELEMENT                                ~15     ~17
         19        ASSIGN_DIM                                               !1
         20        OP_DATA                                                  ~15
    6    21        PRE_INC                                                  !2
         22    >   COUNT                                            ~19     !0
         23        SUB                                              ~20     ~19, 1
         24        IS_SMALLER                                               !2, ~20
         25      > JMPNZ                                                    ~21, ->14
   10    26    >   INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.79 ms | 1396 KiB | 17 Q