3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth']; $chose = []; $result = []; foreach($data as $i=>$item) { $pair = array_rand(array_diff_key($data, array_merge($chose, [$i]))); $chose[] = $pair; $result[]= [$item, $data[$pair]]; } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/IvZAt
function name:  (null)
number of ops:  32
compiled vars:  !0 = $data, !1 = $chose, !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, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3      > FE_RESET_R                                       $9      !0, ->27
          4    > > FE_FETCH_R                                       ~10     $9, !3, ->27
          5    >   ASSIGN                                                   !4, ~10
    8     6        INIT_FCALL                                               'array_rand'
          7        INIT_FCALL                                               'array_diff_key'
          8        SEND_VAR                                                 !0
          9        INIT_FCALL                                               'array_merge'
         10        SEND_VAR                                                 !1
         11        INIT_ARRAY                                       ~12     !4
         12        SEND_VAL                                                 ~12
         13        DO_ICALL                                         $13     
         14        SEND_VAR                                                 $13
         15        DO_ICALL                                         $14     
         16        SEND_VAR                                                 $14
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !5, $15
    9    19        ASSIGN_DIM                                               !1
         20        OP_DATA                                                  !5
   10    21        INIT_ARRAY                                       ~19     !3
         22        FETCH_DIM_R                                      ~20     !0, !5
         23        ADD_ARRAY_ELEMENT                                ~19     ~20
         24        ASSIGN_DIM                                               !2
         25        OP_DATA                                                  ~19
    6    26      > JMP                                                      ->4
         27    >   FE_FREE                                                  $9
   12    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.2 ms | 1396 KiB | 21 Q