How to read a file into a string using PHP

28 Feb 2009

    function ReadFile($filename)
    {
        $fh = fopen($filename, 'r');
        $theData = fread($fh, filesize($filename));
        fclose($fh);
        return $theData;
    }