Reading a File with fread()
<html>
<head>
<title>Reading a File with fread()</title>
</head>
<body>
<div>
<?php
$filename = "data.txt";
$fp = fopen( $filename, "r" ) or die("Couldn't open $filename");
while ( ! feof( $fp ) ) {
$chunk = fread( $fp,16 );
print "$chunk<br/>";
}
?>
</div>
</body>
</html>
Related examples in the same category