PHP: Variable changes value without seemingly any reason
<pre><code>$subjectDirectory = '../blogtext/';
$subjectHandle = opendir( $subjectDirectory );
$fileName = $_SERVER['PHP_SELF'];
$tempArray = explode( '-', $fileName );
$finalNum = '-'.$tempArray[1].'-';
$subjectFile;
if( $subjectHandle = opendir( '../blogtext/' ) )
{
    /* If you echo $finalNum here, you get '-0-' on the page. */
    while( false !== ( $subjectFile = readdir( $subjectHandle ) ) )
    {
        /* If you echo $finalNum here, you get '-0--0--0--0--0-' on the page. */
        if( $subjectFile != '.' &amp;&amp; $subjectFile != '..' &amp;&amp; !is_dir( $subjectFile ) &amp;&amp; strpos( $subjectFile, $finalNum ) ) 
        {
            include( $subjectFile );
        }
    }
    closedir( $subjectHandle );
}
</code></pre>

<p>Basically, what I'm trying to do is;
get -NUMBER- code from the current file name ( -0-example.php ), and then scan through the directory ( $subjectDirectory ) for the file name that begins with the same code. Then include the file.</p>

<p>I'm unable to do so because the $finalNum changes the code to "code 5 times in a row", so I can't find the right file to include.</p>
