title: How to check not in array element
body: <p>I am trying to check if an element is not in array than want to redirect page:
  My code is as below:</p>
  <pre><code>$id = $access_data['Privilege']['id']; 
  
  if(!in_array($id,$user_access_arr))
  {
      $this-&gt;Session-&gt;setFlash(__('Access Denied! You are not eligible to access this.'), 'flash_custom_success');
      return $this-&gt;redirect(array('controller'=&gt;'Dashboard','action'=&gt;'index'));
  }
  </code></pre>
  <p>I am confused how to check if element is not in array.
  As we can check element exist or not in array using <code>in_array</code> function of PHP.
  I am trying to check it using <code>(!in_array)</code> but I did not got result.</p>