title: How can I check that an array key exist if the array does not exist in PHP
body: <p>I am in a bind, multiple times on a page for different form items, I insert a css div class into a form item ONLY if an error_array key exists, this is how I highlight a form item that has an error in it.</p>
  
  <p>Works, great if I have an error because then my error array is set, problem is before an error is set, it tries to look for an array key that does not exist.  I was thinking using php's isset function first would be the ticket but I guess you cannot combine isset with another function?</p>
  
  <hr>
  
  <pre><code>&lt;?php
  //this works
  $search_array = array('first' =&gt; 1, 'second' =&gt; 4);
  
  if (array_key_exists('first', $search_array)){
      echo "good";
  }
  
  
  // this does not work, will give write errors
  $search_array = array('first' =&gt; 1, 'second' =&gt; 4);
  
  if (isset(array_key_exists('first', $search_array))){
      echo "good";
  }
  
  // Here is  1 example how I need to make the end result work
  $country_class = (array_key_exists('country', $signup_errors)) ? ' signup_error' : ' signup_good';
  echo '&lt;select name="country" id="country" class="textarealong ' .$country_class. '"/&gt;';
  ?&gt;
  </code></pre>
  
  <p>In other parts I use it like this</p>
  
  <pre><code>&lt;?PHP echo(array_key_exists('password', $signup_errors)) ? ' signup_error' : ' signup_good';?&gt;
  </code></pre>
  
  <p>And I need to have it be a 1 line code if possible</p>