more work with file io

This commit is contained in:
Dan Buch 2010-12-31 01:46:02 -05:00
parent 15b891ff97
commit e39e9cc091

View File

@ -13,6 +13,7 @@ mkheader('files!', '#aaa');
// do nothing! // do nothing!
$handle = fopen('data.txt', 'r'); $handle = fopen('data.txt', 'r');
fclose($handle); fclose($handle);
print "didn't actually do anything here ...";
?></pre> ?></pre>
@ -25,5 +26,19 @@ mkheader('files!', '#aaa');
?></pre> ?></pre>
<!-- ======================================================= -->
<pre><?php
$lines = file('data.txt');
foreach($lines as $key => $line) {
$linenum = $key + 1;
print "Line $linenum: $line";
}
?></pre>
</body> </body>
</html> </html>