How to read a text file with PHP?
<p>I have a text file named <code>Se7enPlug.dspl</code>. In this file I have only one line of text, formatted like this:</p>

<pre><code>text1,text2,text3
</code></pre>

<p>I need to read this file and return something like this:</p>

<pre><code>public function rconGetNextMap() {

    $myFile = "E:\mw3-server\admin\Se7enPlug.dspl";
    $fh = fopen($myFile, 'r');
    $theData = fread($text1,$text2,$text3);
    fclose($fh);
    echo $theData;

    if ($theData) {

        $next = array("map" =&gt; $text1, "gametype" =&gt; $text2, 0=&gt;$text1, 1=&gt;$text2);
    }
    elseif (!$theData)) {

        $next = array("map" =&gt; "Unknown", "gametype" =&gt; "Unknown", 0=&gt;"Unknown",1=&gt;"Unknown");
    }
    return $next;
}
</code></pre>

<p>As you see its has many problems. How can I fix it?</p>
