Skip to content

Instantly share code, notes, and snippets.

@imlucas
Created June 10, 2009 14:35
Show Gist options
  • Select an option

  • Save imlucas/127246 to your computer and use it in GitHub Desktop.

Select an option

Save imlucas/127246 to your computer and use it in GitHub Desktop.
<?
// The infamous michael buble case
// takes "michael da buble" and turns that into "buble, michael da"
// which is how amg stores it
$lastname = substr($name, strrpos($name, " ")+1);
$firstname = str_replace(" ".$lastname, "", $name);
$assembled = $lastname.", ".$firstname;
$k = new self;
$k->whereAddEqual('key_name', $assembled);
$k->limit(0,10);
$objects = $k->fetchAllObjects();
if(count($objects) > 0){
return $objects;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment