Skip to content

Instantly share code, notes, and snippets.

@rogervila
Last active January 14, 2021 20:15
Show Gist options
  • Save rogervila/756ec63fc1820e9578b50847fd7a3948 to your computer and use it in GitHub Desktop.
Save rogervila/756ec63fc1820e9578b50847fd7a3948 to your computer and use it in GitHub Desktop.
Array Diff Example
<?php
$a = [
'a' => 'Hello',
'c' => 'd',
];
$b = [
'a' => 'Goodbye',
'c' => 'd',
];
$result = array_diff($a, $b);
var_dump($result);
/*
$result content:
array(1) {
["a"]=>
string(5) "Hello"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment