Please send questions to st10@humboldt.edu .
<html>

<!-- files3.php
     
     by: Sharon Tuttle
     last modified: 12-05-06
-->

<head>
    <title> playing with PHP and files - 3 </title>
</head>

<body>
    <h2> playing with PHP and files - 3 </h2>    

    <h3>
    <?php
        print "About to open lines_to_show.txt<br><br>\n";

        $fileHandle = fopen("lines_to_show.txt", "r")
	    or exit("Cannot open lines_to_show.txt<br>\n");

        $charsInLine = 0;

        // print out all of the alpha characters, ONLY, from
	//    lines_to_show.txt, 80 characters per line...

	while (! feof( $fileHandle ) )
	{
	    $nextchar = fgetc( $fileHandle );

            // ctype_alpha ( ) returns true if all the characters in
            //    the string passed to it are alphabetic

            if ( ctype_alpha( $nextchar ) )
            {
                print $nextchar;
		$charsInLine++;

                if ($charsInLine == 80)
                {
                    print "<br>\n";
                    $charsInLine = 0;
                }
            }
	}
        print "<br>\n";

        // remember to close file when you are done!

        fclose($fileHandle);
    ?> 
    </h3>

</body>
</head>