PHP code example of rogervila / array-diff-multidimensional
1. Go to this page and download the library: Download rogervila/array-diff-multidimensional 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/ */
rogervila / array-diff-multidimensional example snippets
use Rogervila\ArrayDiffMultidimensional;
$new = [
'a' => 'b',
'c' => [
'd' => 'e',
'f' => 'Hello',
],
];
$old = [
'a' => 'b',
'c' => [
'd' => 'e',
'f' => 'Goodbye',
],
];
// Compare the arrays by calling the 'compare' class method
$result = ArrayDiffMultidimensional::compare($new, $old)
// Or by calling the global helper function
$result = array_diff_multidimensional($new, $old)
var_dump($result);
[
'c' => [
'f' => 'Hello'
],
]
// Passing 'false' as a third parameter will deactivate the strict comparison mode
ArrayDiffMultidimensional::compare($new, $old, false);
array_diff_multidimensional($new, $old, false);
// This method call is equivalent
ArrayDiffMultidimensional::looseComparison($new, $old);
// Comparisons are strict by default
ArrayDiffMultidimensional::compare($new, $old);
array_diff_multidimensional($new, $old);
// This method call is equivalent
ArrayDiffMultidimensional::strictComparison($new, $old);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.