fgetss and strip_tags
fgetss function
This function used read a line from a file with out HTML and PHP tags.
for parsing HTML files, we use fgetss rather fgets function .
we can do the same function by the combination of fget and strip_tags function
Syntax:
getss(fp,length);
The following two examples gives the same result.
example : 1
//Using fgetss
<?php
$fp=fopen(’sample.html’,'r’);
while(!feof($fp))
{
echo $str=fgetss($fp,4096);
}
?>
example : 2
//Using strip_tags
<?php
$fp=fopen(’sample.html’,'r’);
while(!feof($fp))
{
$str=fgets($fp);
$str=strip_tags($str);
echo $str;
}
?>
