title: How to make an incrementing loop for checking filename PHP
body: <p>I have data's in server with file names like this(it's on a PDO) :</p>
  
  <pre><code>$row["control_number"]-201909A16.txt
  $row["control_number"]-201910A15.txt
  $row["control_number"]-201906A13.txt
  $row["control_number"]-201910A06.txt
  </code></pre>
  
  <p>the <code>201910</code> is the date of the software revision made and the <code>A06</code> is the version of the software.</p>
  
  <p>then I have a table looks like this :</p>
  
  <pre><code>| id | control_number   | data status | 
  | 1  | 000000-0000      |  ON SERVER  |
  </code></pre>
  
  <p>The value will Output <code>ON SERVER</code> if the data with the same <code>or_number</code> is exist in the server, if not <code>File not found</code></p>
  
  <p>Now I'm thinking an incrementing loop to filter the filenames.</p>
  
  <p>something like this :</p>
  
  <pre><code>///$IncrementFilename must be increment continuesly until it match a file name in the server
  
  $path = 'http://127.0.0.0:0000/data/';
  $path2 = $path.'/'.$row["control_number"].'/'.$row["control_number"].'.$IncrementFilename.'.txt' ; // declare exact path of data
  
  if (fopen($path2, "r")) {
          $tbody .= '&lt;td rowspan="" style="vertical-align:middle;text-align:center;cursor:pointer" class="ON-SERVER" id=""&gt;ON SERVER&lt;/td&gt;';
      } else { //  IF FALSE 
          $tbody .= '&lt;td rowspan="" style="vertical-align:middle;text-align:center;cursor:pointer" class="" id=""&gt;FILE NOT FOUND&lt;/td&gt;';
      }
  </code></pre>
  
  <p>I don't know how to achieve it. So I can't show what I've tried so far..</p>