title: How can I run a "background" infant loop with PHP?
body: <p>I am looking for a way to check if there are any new files in a directory. Can I do this live with some infant loop? When I say:</p>
  
  <pre><code>   &lt;?php
          while (true) {
              $files = glob("../example/*.txt");
            $count_posts = $files !== false ? count($files) : 0;
              if ($count_posts &gt; 0) {
                  break;
              print("WE DID IT!!!!!!!");
              }
          }
          ?&gt; 
  </code></pre>
  
  <p>Three weird things happen: 1.) The page will keep loading - which I can't have 2.) It won't print "WE DID IT!!!!!!!!!" and 3.) No content will be shown until there is a new file. How can I do this?</p>