Skip to content

Instantly share code, notes, and snippets.

@Tocacar
Created July 6, 2012 13:10
Show Gist options
  • Select an option

  • Save Tocacar/3060077 to your computer and use it in GitHub Desktop.

Select an option

Save Tocacar/3060077 to your computer and use it in GitHub Desktop.
looping an object collection
$results = $this->query->execute();
$userIdArray = array(1, 4, 7, 9);
if ($results->count() > 0) {
$users = array();
foreach ($results as $result) {
if ( in_array($result->user_id, $userIdArray ) && $result->meta_key == 'value I'm looking for')
$users[$result->user_id] = 'hit';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment