Reading Characters with fgetc() : fgetc « File Directory « PHP






Reading Characters with fgetc()

 
<html>
<head>
<title>Reading Characters with fgetc()</title>
</head>
<body>
<div>
<?php
    $filename = "test.txt";
    $fp = fopen( $filename, "r" ) or die("Couldn't open $filename");
    while ( ! feof( $fp ) ) {
     $char = fgetc( $fp );
     print "$char<br/>";
    }
?>
</div>
</body>
</html>
  
  








Related examples in the same category

1.fgetc() function returns one character from the file or returns false on reaching the end of file.