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) { unset($temp[$i]); $result = [$item, $temp[array_rand($temp)]]; } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/KfJjj
function name:  (null)
number of ops:  20
compiled vars:  !0 = $data, !1 = $temp, !2 = $result, !3 = $item, !4 = $i
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                                       $8      !0, ->15
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->15
          5    >   ASSIGN                                                   !4, ~9
    8     6        UNSET_DIM                                                !1, !4
    9     7        INIT_ARRAY                                       ~11     !3
          8        INIT_FCALL                                               'array_rand'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $12     
         11        FETCH_DIM_R                                      ~13     !1, $12
         12        ADD_ARRAY_ELEMENT                                ~11     ~13
         13        ASSIGN                                                   !2, ~11
    6    14      > JMP                                                      ->4
         15    >   FE_FREE                                                  $8
   11    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.52 ms | 1399 KiB | 17 Q