title: PHP: What's wrong with this code, and why won't the variable increment?
body: <pre><code>$blogDir = 'blog/';
  $blogdirHandle = opendir( $blogDir );
  $checkingFile;
  $number = 0;
  $codeNumber = '-'.$number.'-';
  if( $blogdirHandle = opendir( 'blog/' ) )
  {
      while( ( $checkingFile = readdir( $blogdirHandle ) ) !== false ) 
      {
          if( $checkingFile != '.' &amp;&amp; $checkingFile != '..' &amp;&amp; !is_dir( $checkingFile ) &amp;&amp; strpos( $checkingFile, $codeNumber ) !== false )
          {
              $number++;
          }
      }
      closedir( $blogdirHandle );
  }
  </code></pre>
  
  <p>What I'm trying to do is:</p>
  
  <p>Go through the $blogDir directory, and search for a file that has the same $codeNumber ( -$number- ), and if a file is found, then increase $number by one and search until all files are searched through. For some reason it's not working. It won't increase the value of $number, even though there are files with the same $codeNumber in the directory.. Any help?</p>