1.

Following is the code to count total number of characters from a text file. Fill in the blanks so that this code can work:<? php$file = _______(“data.txt”, “r”);$ch = 0;while(_______($file)){$letter= ________________________;$ch = ________________________;}echo “Number of characters:”, $ch;fclose($file);?>

Answer»

<? Php

$file = fopen(“data.txt”, “r”);

$ch = 0;

while(!feof($file))

{

$letter=fgetc($file);

$ch=$ch+1;

}

echo “Number of characters:”, $ch;

fclose($file);

?>



Discussion

No Comment Found

Related InterviewSolutions