title: Scan directory with PHP and use results in JavaScript
body: <p>I scan a directory with PHP which includes only folders:</p>
  
  <pre><code>$folders = scandir('gallery');
  </code></pre>
  
  <p>Now i want to check if a string in javascript a folder in this directory.</p>
  
  <pre><code>if(theString == allTheFolders){
       alert('yay');
  }
  </code></pre>
  
  <p>Now <code>$folders</code> is an array with strings in it. To get all the strings i use a foreach loop and ignore the <code>'.' &amp; '..'</code> directory's. But how can i get all these folders in the if loop?
  Hope you understand my question!</p>