Steph's Code for Read File:

File found!
File is readable -- reading the file.

HXRWRITETEST991

<link rel="stylesheet" href="../css/assignmentHeaderStyles.css" />
<?php
include('../header/assignmentHeader.php');
// code
error_reporting(E_ALL);    // set error reporting to all

echo("<h1>Steph's Code for Read File:</h1>");
$myFile = '../doc/text.txt';
if(
file_exists($myFile))        // does file exist?
{
    echo(
'File found! <br>');

    
$handle = fopen($myFile, 'r');    // try reading the file
    
if($handle)
    {
        echo(
'File is readable -- reading the file. <br><br>');

        
// read the contents of the counter file
        
$content= fread($handle,  filesize($myFile));
        
fclose($handle);
        
$content = nl2br($content);    // add new line breaks (i.e., <br>)
        
echo("<p> $content</p>");
    }
    else
    {
        echo(
"Cannot read the $myFile <br>");
    }
}
else
{
    echo(
'File NOT found! <br>');
}

show_source(__FILE__);
include(
'../footer/footer.php');
?>