Skip to content

Instantly share code, notes, and snippets.

@sany2k8
Created February 14, 2017 05:05
Show Gist options
  • Save sany2k8/025a0001b827c3d21f5ce6ad89df9fd1 to your computer and use it in GitHub Desktop.
Save sany2k8/025a0001b827c3d21f5ce6ad89df9fd1 to your computer and use it in GitHub Desktop.
array filtering between two different json object
<?php
$array1 = json_decode(file_get_contents('country_list.json'),1);
$array2 = json_decode(file_get_contents('country_list_en.json'),1);
$arrayDiff = array_filter($array2, function ($element) use ($array1) {
return !in_array($element, $array1);
});
print '<pre>';
print_r($arrayDiff);
print '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment