private function getCardinalRole($userRoles) { $roleModel = $this->getGlobalModel('RoleGateway'); $allRoles = $roleModel->getAll(); $highRole = array('name' => '', 'cardinality' => 0); // var_dump($userRoles); works, prints out array(1) { [0]=> string(14) "Loan Processor" } foreach($allRoles as $role) { // var_dump($userRoles); fails, causes (seemingly) for php to freak out, and for a download dialogue to be initiated to download "index.php" (the name of the script) if(in_array($role->name, $userRoles) && $role->cardinality > $highRole['cardinality']) { $highRole = array('name' => $role->name, 'cardinality' => $role->cardinality); } } return $highRole; }