3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstArray = array('22','24','23','26','22','24','23','26'); $secondArray = array('John','Smith','Mark','Steve','George','Nick','Sean','Brad'); $thirdArray = array('A','B','D','E','F','G','H','I'); $new1 = []; $new2 = []; $new3 = []; foreach ($firstArray as $index => $value) { if (!isset($ref[$value])) { $new1[] = &$ref[$value][0]; $new2[] = &$ref[$value][1]; $new3[] = &$ref[$value][2]; } $ref[$value][0] = $value; $ref[$value][1] = $secondArray[$index]; $ref[$value][2] = $thirdArray[$index]; } var_dump($new1, $new2, $new3);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 39
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 39
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/QhsJf
function name:  (null)
number of ops:  46
compiled vars:  !0 = $firstArray, !1 = $secondArray, !2 = $thirdArray, !3 = $new1, !4 = $new2, !5 = $new3, !6 = $value, !7 = $index, !8 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    8     3        ASSIGN                                                   !3, <array>
    9     4        ASSIGN                                                   !4, <array>
   10     5        ASSIGN                                                   !5, <array>
   11     6      > FE_RESET_R                                       $15     !0, ->39
          7    > > FE_FETCH_R                                       ~16     $15, !6, ->39
          8    >   ASSIGN                                                   !7, ~16
   12     9        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !8, !6
         10        BOOL_NOT                                         ~19     ~18
         11      > JMPZ                                                     ~19, ->27
   13    12    >   FETCH_DIM_W                                      $21     !8, !6
         13        FETCH_DIM_W                                      $22     $21, 0
         14        MAKE_REF                                         $23     $22
         15        FETCH_DIM_W                                      $20     !3
         16        ASSIGN_REF                                               $20, $23
   14    17        FETCH_DIM_W                                      $26     !8, !6
         18        FETCH_DIM_W                                      $27     $26, 1
         19        MAKE_REF                                         $28     $27
         20        FETCH_DIM_W                                      $25     !4
         21        ASSIGN_REF                                               $25, $28
   15    22        FETCH_DIM_W                                      $31     !8, !6
         23        FETCH_DIM_W                                      $32     $31, 2
         24        MAKE_REF                                         $33     $32
         25        FETCH_DIM_W                                      $30     !5
         26        ASSIGN_REF                                               $30, $33
   17    27    >   FETCH_DIM_W                                      $35     !8, !6
         28        ASSIGN_DIM                                               $35, 0
         29        OP_DATA                                                  !6
   18    30        FETCH_DIM_R                                      ~39     !1, !7
         31        FETCH_DIM_W                                      $37     !8, !6
         32        ASSIGN_DIM                                               $37, 1
         33        OP_DATA                                                  ~39
   19    34        FETCH_DIM_R                                      ~42     !2, !7
         35        FETCH_DIM_W                                      $40     !8, !6
         36        ASSIGN_DIM                                               $40, 2
         37        OP_DATA                                                  ~42
   11    38      > JMP                                                      ->7
         39    >   FE_FREE                                                  $15
   21    40        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !3
         42        SEND_VAR                                                 !4
         43        SEND_VAR                                                 !5
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.55 ms | 1005 KiB | 14 Q