title: PHP Jump to folder number
body: <p>I have this code that lists all the folders in a directory and numbers each folder, but my desire is to be able to go to a specific folder when I want to start, for example:</p>
  <p>The code listed all folders after that done, I would like to go to folder 40 how do I get the path of folder number 40 ? I would like to write a file there.</p>
  <p>I thought about putting the folders in an array, but there is nothing simpler where I don't need to use an array because it will be a very large directory I will make a repository.</p>
  <p>List folder source:</p>
  <pre><code>$foldercount = 0;
  foreach (glob(&quot;folderlist/&quot;) as $folder) {
    $foldercount++; 
  }
  </code></pre>