• PHP Video Tutorials

PHP - Function fgetss()



The fgetss() function can return a line with HTML and PHP tags removed from an open file. This function can stop returning on a new line at specified length or EOF, whichever comes first and return false on failure.

Syntax

string fgetss ( resource $handle [, int $length [, string $allowable_tags ]] )

This function is similar to fgets() function except that fgetss() function can attempt to strip any HTML and PHP tags from text it reads.

Example-1

<?php
   $handle = @fopen("/PhpProject/test.php", "r");
   if ($handle) {
      while (!feof($handle)) {
         $buffer = fgetss($handle, 4096);
         echo $buffer;
      }
      fclose($handle);
   }
?>

Output

Welcome to Tutorialspoint  

Example-2

<?php
   $handle = @fopen("/PhpProject/test.php", "r");
   if ($handle) {
      while (!feof($handle)) {
         $buffer = fgetss($handle, 4096, "

, "); echo $buffer; } fclose($handle); } ?>

Output

Welcome to Tutorialspoint

php_function_reference.htm
Advertisements