PHP code example of niko9911 / diff-multidimensional-array

1. Go to this page and download the library: Download niko9911/diff-multidimensional-array 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/ */

    

niko9911 / diff-multidimensional-array example snippets



declare(strict_types=1);
use Niko9911\ArrayDiff\Multidimensional;


$newResults = [
	'zoo' => 'pets',
	'foo' => [
        'cat',
        'dog',
        'php'
	],
];

$oldResults = [
	'zoo' => 'pets',
	'foo' => [
        'php'
	],
];

var_dump(Multidimensional::diff($new,$old));
/** Will result:
  array(1) {
    'foo' =>
    array(3) {
      [0] =>
      string(3) "cat"
      [1] =>
      string(3) "dog"
      [2] =>
      string(3) "php"
    }
  }
 */