Skip to content

Instantly share code, notes, and snippets.

@tarnus
Created September 15, 2015 16:59
Show Gist options
  • Save tarnus/00ef3f5389a922ceec17 to your computer and use it in GitHub Desktop.
Save tarnus/00ef3f5389a922ceec17 to your computer and use it in GitHub Desktop.
/**
* @param $obj
* @param $field
* @param $value
*
* @return bool|null
*/
function searchJson($obj, $field, $value) {
$item=NULL;
foreach($obj as $struct) {
if ($value == $struct->$field) {
$item = $struct;
return $item;
break;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment