Created
February 14, 2017 05:05
-
-
Save sany2k8/025a0001b827c3d21f5ce6ad89df9fd1 to your computer and use it in GitHub Desktop.
array filtering between two different json object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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