Example of fgetc in PHP, fgetc php, fgetc in php


 

Example of fgetc in PHP, fgetc php, fgetc in php

In this PHP tutorial section you will learn the use of fgetc() function in php.

In this PHP tutorial section you will learn the use of fgetc() function in php.

Learn how to use the fgetc() function in PHP programming.

Syntax

string fgetc ( $file_handler )

It gives a character by character by using the file handler returned by fopen() and fsockopen() function

The string returned is displayed as the content

It is used with feof() function in loops

It is basically used to display the content of the file

Some functions based on character  can be used while getting character  inside the loop

For example @sign,© sign, .sign etc.

Here users have to give the new line character 

If <Br> is used then result will be one character in single line

Code for PHP fgetc() Function

<?php

$file1=fopen("c:/rose1/ram.txt","r");

for (;!feof($file1);)

{

$c=fgetc($file1);

echo $c;

}

?>

Output

welcome to roseindia welcome to roseindia welcome to roseindia welcome to roseindia welcome to roseindia welcome to roseindia

 

Ads