Home Tutorial Php Phpfiles Example of fgetc in PHP, fgetc php, fgetc in php

 
 

Example of fgetc in PHP, fgetc php, fgetc in php
Posted on: September 22, 2009 at 12:00 AM
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

 

Related Tags for Example of fgetc in PHP, fgetc php, fgetc in php:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.