3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar_val="134567,dogs,food,EEUU"; $ar_url="134567,dogs,toys,EEUU"; $arrayVal = explode($ar_val, ','); $arrayUrl = explode($ar_url, ','); $maxLength = max(sizeof($arrayVal), sizeof($arrayUrl)); $arrayIdsEqual = array(); $arrayIdsDifferent = array(); for ($i = 0; $i < $maxLength; $i++) { if (isset($arrayVal[$i]) && isset($arrayUrl[$i])) { if ($arrayVal[$i] == $arrayUrl[$i]) { $arrayIdsEqual[] = $i; } else { $arrayIdsDifferent[] = $i; } } else { //you arrive here if you have 2 arrays that don't have the same size / sme number of variables } } print_r($arrayIdsDifferent); //assuming your 2 arrays ALWAYS have the same size, you can use the following logic if (empty($arrayIdsDifferent)) { echo '2 arrays are the same'; } else { echo 'Differences: '; foreach ($arrayIdsDifferent as $indexDifferent => $currentIdDifferent) { $output = 'difference ' . $indexDifferent + 1 . ': '; $output .= 'val = ' . $arrayVal[$currentIdDifferent]; $output .= 'url = ' . $arrayUrl[$currentIdDifferent]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 23
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 77) Position 1 = 50, Position 2 = 63
Branch analysis from position: 50
2 jumps found. (Code = 78) Position 1 = 51, Position 2 = 63
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 38
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 23
Branch analysis from position: 41
Branch analysis from position: 23
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 38
Branch analysis from position: 27
filename:       /in/buCpf
function name:  (null)
number of ops:  65
compiled vars:  !0 = $ar_val, !1 = $ar_url, !2 = $arrayVal, !3 = $arrayUrl, !4 = $maxLength, !5 = $arrayIdsEqual, !6 = $arrayIdsDifferent, !7 = $i, !8 = $currentIdDifferent, !9 = $indexDifferent, !10 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '134567%2Cdogs%2Cfood%2CEEUU'
    4     1        ASSIGN                                                   !1, '134567%2Cdogs%2Ctoys%2CEEUU'
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 '%2C'
          5        DO_ICALL                                         $13     
          6        ASSIGN                                                   !2, $13
    7     7        INIT_FCALL                                               'explode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 '%2C'
         10        DO_ICALL                                         $15     
         11        ASSIGN                                                   !3, $15
    9    12        INIT_FCALL                                               'max'
         13        COUNT                                            ~17     !2
         14        SEND_VAL                                                 ~17
         15        COUNT                                            ~18     !3
         16        SEND_VAL                                                 ~18
         17        DO_ICALL                                         $19     
         18        ASSIGN                                                   !4, $19
   10    19        ASSIGN                                                   !5, <array>
   11    20        ASSIGN                                                   !6, <array>
   13    21        ASSIGN                                                   !7, 0
         22      > JMP                                                      ->39
   14    23    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~24     !2, !7
         24      > JMPZ_EX                                          ~24     ~24, ->27
         25    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~25     !3, !7
         26        BOOL                                             ~24     ~25
         27    > > JMPZ                                                     ~24, ->38
   15    28    >   FETCH_DIM_R                                      ~26     !2, !7
         29        FETCH_DIM_R                                      ~27     !3, !7
         30        IS_EQUAL                                                 ~26, ~27
         31      > JMPZ                                                     ~28, ->35
   16    32    >   ASSIGN_DIM                                               !5
         33        OP_DATA                                                  !7
         34      > JMP                                                      ->37
   19    35    >   ASSIGN_DIM                                               !6
         36        OP_DATA                                                  !7
         37    > > JMP                                                      ->38
   13    38    >   PRE_INC                                                  !7
         39    >   IS_SMALLER                                               !7, !4
         40      > JMPNZ                                                    ~32, ->23
   26    41    >   INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !6
         43        DO_ICALL                                                 
   29    44        ISSET_ISEMPTY_CV                                         !6
         45      > JMPZ                                                     ~34, ->48
   30    46    >   ECHO                                                     '2+arrays+are+the+same'
         47      > JMP                                                      ->64
   33    48    >   ECHO                                                     'Differences%3A+'
   34    49      > FE_RESET_R                                       $35     !6, ->63
         50    > > FE_FETCH_R                                       ~36     $35, !8, ->63
         51    >   ASSIGN                                                   !9, ~36
   35    52        ADD                                              ~38     !9, 1
         53        CONCAT                                           ~39     'difference+', ~38
         54        CONCAT                                           ~40     ~39, '%3A+'
         55        ASSIGN                                                   !10, ~40
   36    56        FETCH_DIM_R                                      ~42     !2, !8
         57        CONCAT                                           ~43     'val+%3D+', ~42
         58        ASSIGN_OP                                     8          !10, ~43
   37    59        FETCH_DIM_R                                      ~45     !3, !8
         60        CONCAT                                           ~46     'url+%3D+', ~45
         61        ASSIGN_OP                                     8          !10, ~46
   34    62      > JMP                                                      ->50
         63    >   FE_FREE                                                  $35
   39    64    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.65 ms | 1405 KiB | 19 Q