Description:
The fgetc() function is used to read a single character from a file.
Note:After a call to this function the file pointer moves to the next character.
The example below reads a file character by character,until the end of file is reached..
Code:
<?php
$f=fopen("file1.txt","r") or exit("unable to open file!");
while(!feof($f))
{
echo fgetc($f);
}
?>
Output:
The fgetc() function is used to read a single character from a file.
Note:After a call to this function the file pointer moves to the next character.
The example below reads a file character by character,until the end of file is reached..
Code:
<?php
$f=fopen("file1.txt","r") or exit("unable to open file!");
while(!feof($f))
{
echo fgetc($f);
}
?>
Output:
No comments:
Post a Comment