Simply
$os = array("Mac", "NT", "Irix", "Linux");if (!in_array("BB", $os)) { echo "BB is not found";}
I prefer this
if(in_array($id,$user_access_arr) == false)
respective
if (in_array(search_value, array) == false) // value is not in array
if (in_array($id,$user_access_arr)==0){ $this->Session->setFlash(__('Access Denied! You are not eligible to access this.'), 'flash_custom_success'); return $this->redirect(array('controller'=>'Dashboard','action'=>'index'));}