PHP Leraning : Character by Character fgetc() function - Publik Talk

Breaking

An informative website for every one.

Post Top Ad

Post Top Ad

Wednesday, August 2, 2017

PHP Leraning : Character by Character fgetc() function

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:



No comments:

Post a Comment

Post Top Ad