Skip to content

Instantly share code, notes, and snippets.

@jimrubenstein
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimrubenstein/e09586cd341d0ed6acc0 to your computer and use it in GitHub Desktop.
Save jimrubenstein/e09586cd341d0ed6acc0 to your computer and use it in GitHub Desktop.
<?php
function findObjectById($objects, $id)
{
foreach ($objects as $obj)
{
if ($obj->programId == $id)
{
return $obj;
}
}
return false;
}
$myObjects = array(); // <-- populate your objects here
$myObj = findObjectById($myObjects, 12451);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment