Skip to content

Instantly share code, notes, and snippets.

@mcocciaTE
Created June 18, 2014 22:23
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 mcocciaTE/65a24e318af7b4339b26 to your computer and use it in GitHub Desktop.
Save mcocciaTE/65a24e318af7b4339b26 to your computer and use it in GitHub Desktop.
public function my_cmp($a, $b){
return strcmp($a["message"], $b["message"]);
}
/**
* Test 4: Fortunes
*/
public function fortunesAction()
{
$fortunes = Registry::get('em')->fortune->getAll();
$fortunes[] = array(
'id' => count($fortunes) + 1,
'message' => 'Additional fortune added at request time.'
);
usort($fortunes, "my_cmp");
$view = new View('table.phtml', array('fortunes' => $fortunes));
$this->response->asHTML()->send($view);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment