3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth']; $temp = $data; $result = []; foreach($data as $i=>$item) { $item = array_shift($temp); $pair = array_rand($temp); $result[] = [$item, $temp[$pair]]; unset($temp[$pair]); } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/bcdGM
function name:  (null)
number of ops:  26
compiled vars:  !0 = $data, !1 = $temp, !2 = $result, !3 = $item, !4 = $i, !5 = $pair
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, !0
    5     2        ASSIGN                                                   !2, <array>
    6     3      > FE_RESET_R                                       $9      !0, ->21
          4    > > FE_FETCH_R                                       ~10     $9, !3, ->21
          5    >   ASSIGN                                                   !4, ~10
    8     6        INIT_FCALL                                               'array_shift'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !3, $12
    9    10        INIT_FCALL                                               'array_rand'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !5, $14
   10    14        INIT_ARRAY                                       ~17     !3
         15        FETCH_DIM_R                                      ~18     !1, !5
         16        ADD_ARRAY_ELEMENT                                ~17     ~18
         17        ASSIGN_DIM                                               !2
         18        OP_DATA                                                  ~17
   11    19        UNSET_DIM                                                !1, !5
    6    20      > JMP                                                      ->4
         21    >   FE_FREE                                                  $9
   14    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.22 ms | 1395 KiB | 19 Q