3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ["Paris SG", "Brest", "Monaco", "Nizza", "Lilla", "Lens", "Sturm Graz"], ["Marsiglia", "Rennes", "Reims", "Lione", "Tolosa", "Strasburgo"], ["Le Havre", "Montpellier", "Lorient", "Nantes", "Metz", "Clermont"], ]; $array2 = [ "Sturm Graz", "Rennes", "Sturm Graz", "Reims", "Tolosa", "Le Havre", "Paris SG", "Lione", "Clermont", "Montpellier", "Lorient", "Strasburgo" ]; $result = []; foreach ($array1 as $row) { foreach ($row as $val) { $i = array_search($val, $array2); if ($i !== false) { unset($array2[$i]); $result[] = $val; } } } var_export($array2); echo "\n---\n"; var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 18
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/pMJHT
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $row, !4 = $val, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   24     2        ASSIGN                                                   !2, <array>
   25     3      > FE_RESET_R                                       $9      !0, ->20
          4    > > FE_FETCH_R                                               $9, !3, ->20
   26     5    > > FE_RESET_R                                       $10     !3, ->18
          6    > > FE_FETCH_R                                               $10, !4, ->18
   27     7    >   INIT_FCALL                                               'array_search'
          8        SEND_VAR                                                 !4
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !5, $11
   28    12        TYPE_CHECK                                  1018          !5
         13      > JMPZ                                                     ~13, ->17
   29    14    >   UNSET_DIM                                                !1, !5
   30    15        ASSIGN_DIM                                               !2
         16        OP_DATA                                                  !4
   26    17    > > JMP                                                      ->6
         18    >   FE_FREE                                                  $10
   25    19      > JMP                                                      ->4
         20    >   FE_FREE                                                  $9
   34    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
   35    24        ECHO                                                     '%0A---%0A'
   36    25        INIT_FCALL                                               'var_export'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.64 ms | 1015 KiB | 15 Q