title: How to use foreach to return true/false
body: <p>How can I use foreach to return true or false. </p>
  
  <p>For example, this isn't working. </p>
  
  <pre><code>function checkArray($myArray) {
      foreach( $myArray as $key=&gt;$value ) {
         if(!$value == $condition) {
            return false;
         }
         else {
            return true;
         }
  }
  
  if ($checkArray == true) {
  // do something
  }
  </code></pre>
  
  <p>What is the correct syntax for using foreach as true/false function? If you can't do it, could you use it to change an existing variable to true/false instead?</p>