PHP code example of drlenux / array-smart-diff

1. Go to this page and download the library: Download drlenux/array-smart-diff library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drlenux / array-smart-diff example snippets




$a = ['a' => 1, 'b' => 2, 'd' => 4];
$b = ['a' => 2, 'b' => 2, 'c' => 3];

\DrLenux\ArrayDiff::getDiff($a, $b);



[
    'a' => [
        'new' => 2, 
        'old' => 1
    ], 
    'c' => [
        'new' => 3
    ], 
    'd' => [
        'old' => 4
    ]
];