PHP - use of variable : <p>I want my PHP code to display one out of N .txt files on my webpage. (If I visit example.com/index.php?l=1 it should display 1.txt) I´m using a variable for the numbers called $m. $m is defined correctly as it is working on other pages.</p>

<p>My problem is that I can´t define the location of "1.txt" with a variable. My code is:</p>

<pre><code>    $filename = "C:\xampp\project\Logs\.$m.'.txt';
                if (file_exists($filename)) {
                    if (is_readable($filename)) {
                        $handle = fopen($filename, 'r');
                        if (filesize($filename) &gt; 0) {
                            $contents = fread($handle, filesize($filename));
                            fclose($handle);
                            $contents = str_replace('\r\n', "\r\n", $contents);


                            echo ' &lt;textarea data-autoresize class="form-control vresize" id="info" rows="20"&gt;'.$contents.'&lt;/textarea&gt;';    
                        } else {
                             echo ' &lt;textarea data-autoresize class="form-control vresize" id="info" rows="20"&gt;&lt;/textarea&gt;'; 
                        }    
                    }
                } else {
                    echo '&lt;br&gt;&lt;font color=red&gt;Cant get any Logs for ID: '.$m.'&lt;/font&gt;';
                }
</code></pre>

<p>I tried a few different things but nothing worked out for me because $m does not get resolved in $filename.</p>

<p>Was anybody able to follow my description and understands my problem? Help is very appreciated!</p>
