title: PHP get file listing including sub directories
body: <p>I am trying to retrieve all images in a directory, including all subdirectories. I am currently using</p>
  
  <pre><code>$images = glob("{images/portfolio/*.jpg,images/portfolio/*/*.jpg,images/portfolio/*/*/*.jpg,images/portfolio/*/*/*/*.jpg}",GLOB_BRACE);
  </code></pre>
  
  <p>This works, however the results are:</p>
  
  <pre><code>images/portfolio/1.jpg
  images/portfolio/2.jpg
  images/portfolio/subdirectory1/1.jpg
  images/portfolio/subdirectory1/2.jpg
  images/portfolio/subdirectory2/1.jpg
  images/portfolio/subdirectory2/2.jpg
  images/portfolio/subdirectory1/subdirectory1/1.jpg
  images/portfolio/subdirectory1/subdirectory1/2.jpg
  </code></pre>
  
  <p>I want it to do a whole directory branch at a time so the results are:</p>
  
  <pre><code>images/portfolio/1.jpg
  images/portfolio/2.jpg
  images/portfolio/subdirectory1/1.jpg
  images/portfolio/subdirectory1/2.jpg
  images/portfolio/subdirectory1/subdirectory1/1.jpg
  images/portfolio/subdirectory1/subdirectory1/2.jpg
  images/portfolio/subdirectory2/1.jpg
  images/portfolio/subdirectory2/2.jpg
  </code></pre>
  
  <p>Greatly appreciate any help, cheers! </p>
  
  <p>P.S It would also be great if I could just get all subdirectories under portfolio without having to specifically state each directory with a wild card.</p>