title: PHP glob a directory going wrong in some cases why?
body: <p>I have a mistery with my PHP code going wrong in some cases and I don't understand why. 
  My current code is displaying all photos related to the client by a range.</p>
  
  <p>Example: pick all inside the folder from pictures 300 to 310 and display them.</p>
  
  <p>Example of photos names inside my folder: C20_0385, C20_0386, C20_0389, C20_0400...</p>
  
  <p>Current PHP code: with photos from 385 to 420.</p>
  
  <pre><code>$start = 385:
  $end = 420;
  
  $dirname = "smallphotos/$jour_creation - $date_creation/$session/$dossier";
  
  $filenames = glob("$dirname/*{" . implode(",", range($start, $end)) . "}*", GLOB_BRACE);
  
  foreach ($filenames as $filename)
  {
  echo "&lt;img class=\"img-responsive\" src=\"$filename\" alt=\"$filename\"&gt;";
  }
  </code></pre>
  
  <p>That works perfectly and now if I do <code>$start = 385; $end = 450;</code></p>
  
  <p>It write errors: </p>
  
  <pre><code>Warning: glob(): Pattern exceeds the maximum allowed length of 260 characters
  Warning: Invalid argument supplied for foreach()
  </code></pre>
  
  <p>If I do from <code>$start = 385; $end = 435;</code> it shows the whole folder currently up to C20_503.JPG</p>
  
  <p>It looks like for small range more or less 40 photos it does the job but for more something is going wrong.</p>