I want to check if an element is not in the array and then want to redirect the page: My code is as below:
$id = $access_data['Privilege']['id']; 
if(!in_array($id,$user_access_arr))
{
    $this->Session->setFlash(__('Access Denied! You are not eligible to access this.'), 'flash_custom_success');
    return $this->redirect(array('controller'=>'Dashboard','action'=>'index'));
}
How to determine whether an element is in an array baffles me? We may use PHP's in array function to determine whether an element is present in an array. I tried using (!in array) to check it, but I did not get a result.