3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_diff_assoc_recursive($array1, $array2) { foreach($array1 as $key => $value) { if(is_array($value)) { if(!isset($array2[$key])) { $difference[$key] = $value; } elseif(!is_array($array2[$key])) { $difference[$key] = $value; } else { $new_diff = array_diff_assoc_recursive($value, $array2[$key]); if($new_diff != FALSE) { $difference[$key] = $new_diff; } } } elseif(!isset($array2[$key]) || $array2[$key] != $value) { $difference[$key] = $value; } } return !isset($difference) ? 0 : $difference; } $result = array_diff_assoc_recursive(array('a' => array('b' => 'x')), array('a' => array('c' => 'x'))); var_dump($result); $result = array_diff_assoc(array('a' => array('b' => 'x')), array('a' => array('c' => 'x'))); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f05nC
function name:  (null)
number of ops:  17
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'array_diff_assoc_recursive'
          1        SEND_VAL                                                 <array>
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   36     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   37     8        INIT_FCALL                                               'array_diff_assoc'
          9        SEND_VAL                                                 <array>
         10        SEND_VAL                                                 <array>
         11        DO_ICALL                                         $4      
         12        ASSIGN                                                   !0, $4
   38    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function array_diff_assoc_recursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 42
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 42
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 32
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 31
Branch analysis from position: 32
2 jumps found. (Code = 47) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 41
Branch analysis from position: 38
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/f05nC
function name:  array_diff_assoc_recursive
number of ops:  51
compiled vars:  !0 = $array1, !1 = $array2, !2 = $value, !3 = $key, !4 = $difference, !5 = $new_diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2      > FE_RESET_R                                       $6      !0, ->42
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->42
          4    >   ASSIGN                                                   !3, ~7
    8     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~9, ->32
   10     7    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !1, !3
          8        BOOL_NOT                                         ~11     ~10
          9      > JMPZ                                                     ~11, ->13
   12    10    >   ASSIGN_DIM                                               !4, !3
         11        OP_DATA                                                  !2
         12      > JMP                                                      ->31
   14    13    >   FETCH_DIM_R                                      ~13     !1, !3
         14        TYPE_CHECK                                  128  ~14     ~13
         15        BOOL_NOT                                         ~15     ~14
         16      > JMPZ                                                     ~15, ->20
   16    17    >   ASSIGN_DIM                                               !4, !3
         18        OP_DATA                                                  !2
         19      > JMP                                                      ->31
   20    20    >   INIT_FCALL_BY_NAME                                       'array_diff_assoc_recursive'
         21        SEND_VAR_EX                                              !2
         22        CHECK_FUNC_ARG                                           
         23        FETCH_DIM_FUNC_ARG                               $17     !1, !3
         24        SEND_FUNC_ARG                                            $17
         25        DO_FCALL                                      0  $18     
         26        ASSIGN                                                   !5, $18
   21    27        BOOL                                             ~20     !5
         28      > JMPZ                                                     ~20, ->31
   23    29    >   ASSIGN_DIM                                               !4, !3
         30        OP_DATA                                                  !5
         31    > > JMP                                                      ->41
   27    32    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~22     !1, !3
         33        BOOL_NOT                                         ~23     ~22
         34      > JMPNZ_EX                                         ~23     ~23, ->38
         35    >   FETCH_DIM_R                                      ~24     !1, !3
         36        IS_NOT_EQUAL                                     ~25     !2, ~24
         37        BOOL                                             ~23     ~25
         38    > > JMPZ                                                     ~23, ->41
   29    39    >   ASSIGN_DIM                                               !4, !3
         40        OP_DATA                                                  !2
    6    41    > > JMP                                                      ->3
         42    >   FE_FREE                                                  $6
   32    43        ISSET_ISEMPTY_CV                                 ~27     !4
         44        BOOL_NOT                                         ~28     ~27
         45      > JMPZ                                                     ~28, ->48
         46    >   QM_ASSIGN                                        ~29     0
         47      > JMP                                                      ->49
         48    >   QM_ASSIGN                                        ~29     !4
         49    > > RETURN                                                   ~29
   33    50*     > RETURN                                                   null

End of function array_diff_assoc_recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.24 ms | 1407 KiB | 18 Q