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(); print_r($arrayVal); print_r($arrayUrl); 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 } } //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 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 29
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
2 jumps found. (Code = 77) Position 1 = 53, Position 2 = 66
Branch analysis from position: 53
2 jumps found. (Code = 78) Position 1 = 54, Position 2 = 66
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 29
Branch analysis from position: 47
Branch analysis from position: 29
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 44
Branch analysis from position: 33
filename:       /in/RFFE8
function name:  (null)
number of ops:  68
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_VAL                                                 '%2C'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $13     
          6        ASSIGN                                                   !2, $13
    7     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2C'
          9        SEND_VAR                                                 !1
         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        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
   14    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
   15    27        ASSIGN                                                   !7, 0
         28      > JMP                                                      ->45
   16    29    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~26     !2, !7
         30      > JMPZ_EX                                          ~26     ~26, ->33
         31    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~27     !3, !7
         32        BOOL                                             ~26     ~27
         33    > > JMPZ                                                     ~26, ->44
   17    34    >   FETCH_DIM_R                                      ~28     !2, !7
         35        FETCH_DIM_R                                      ~29     !3, !7
         36        IS_EQUAL                                                 ~28, ~29
         37      > JMPZ                                                     ~30, ->41
   18    38    >   ASSIGN_DIM                                               !5
         39        OP_DATA                                                  !7
         40      > JMP                                                      ->43
   21    41    >   ASSIGN_DIM                                               !6
         42        OP_DATA                                                  !7
         43    > > JMP                                                      ->44
   15    44    >   PRE_INC                                                  !7
         45    >   IS_SMALLER                                               !7, !4
         46      > JMPNZ                                                    ~34, ->29
   30    47    >   ISSET_ISEMPTY_CV                                         !6
         48      > JMPZ                                                     ~35, ->51
   31    49    >   ECHO                                                     '2+arrays+are+the+same'
         50      > JMP                                                      ->67
   34    51    >   ECHO                                                     'Differences%3A+'
   35    52      > FE_RESET_R                                       $36     !6, ->66
         53    > > FE_FETCH_R                                       ~37     $36, !8, ->66
         54    >   ASSIGN                                                   !9, ~37
   36    55        ADD                                              ~39     !9, 1
         56        CONCAT                                           ~40     'difference+', ~39
         57        CONCAT                                           ~41     ~40, '%3A+'
         58        ASSIGN                                                   !10, ~41
   37    59        FETCH_DIM_R                                      ~43     !2, !8
         60        CONCAT                                           ~44     'val+%3D+', ~43
         61        ASSIGN_OP                                     8          !10, ~44
   38    62        FETCH_DIM_R                                      ~46     !3, !8
         63        CONCAT                                           ~47     'url+%3D+', ~46
         64        ASSIGN_OP                                     8          !10, ~47
   35    65      > JMP                                                      ->53
         66    >   FE_FREE                                                  $36
   40    67    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 1400 KiB | 19 Q