Created
April 23, 2015 15:36
-
-
Save Xatenev/229baf615673988f9914 to your computer and use it in GitHub Desktop.
Array 1 holds keys which are allowed in Array 2.
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
foreach($articles->category->devices as $device) { // Iterate through all objects | |
foreach ($device as $key => $value) { // Iterate through all properties | |
if (!in_array($key, $allowedFields)) { // Find property in pre-defined array with the properties which are allowed for this object | |
unset($device->$key); // unset the properties which doesn't match the array | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment