Difference between revisions of "PHP:Read a Text File"

From Progzoo
Jump to: navigation, search
(New page: You can open a text file and read each line. ==Reading lines== <question lang="php" className="Demo" copyFile="haggis.txt"><prog> open A, 'haggis.txt'; while (<A>){ chomp; print ...)
 
(Reading lines)
Line 1: Line 1:
 
You can open a text file and read each line.
 
You can open a text file and read each line.
 
==Reading lines==
 
==Reading lines==
<question lang="php" className="Demo" copyFile="haggis.txt"><prog>
+
<question lang="php" className="Demo" copyFile="haggis.txt"><prog><![CDATA[
 +
<?
 
open A, 'haggis.txt';
 
open A, 'haggis.txt';
 
while (&lt;A&gt;){
 
while (&lt;A&gt;){
Line 8: Line 9:
 
}
 
}
 
close A;
 
close A;
 +
?>
 +
]]>
 
</prog>
 
</prog>
 
<p>
 
<p>

Revision as of 11:52, 31 December 2007

You can open a text file and read each line.

Reading lines

The text file [../haggis.txt haggis.txt] includes some lines of text.

[Font] [Default] [Show] [Resize] [History] [Profile]