3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_diff_assoc_recursive($array1, $array2) { $difference=array(); foreach($array1 as $key => $value) { if( is_array($value) ) { if( !isset($array2[$key]) || !is_array($array2[$key]) ) { $difference[$key] = $value; } else { $new_diff = array_diff_assoc_recursive($value, $array2[$key]); if( !empty($new_diff) ) $difference[$key] = $new_diff; } } else if( !array_key_exists($key,$array2) || $array2[$key] !== $value ) { $difference[$key] = $value; } } return $difference; } $a1=array( 'a' => 0, 'b' => null, 'c' => array( 'd' => null ) ); $a2=array( 'a' => 0, 'b' => null ); var_dump( array_diff_assoc_recursive( $a1, $a2 ) ); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SXq5f
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a1, !1 = $a2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   24     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_diff_assoc_recursive'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   25     9      > RETURN                                                   1

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

End of function array_diff_assoc_recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.86 ms | 1403 KiB | 16 Q