Reads a line from a file and strips tags.
The only difference between fgetss() and fgets() is that fgetss() also strips out any html or PHP tags, if present, before returning the data.
It returns a line from the file, up to and including the next new line character. The optional length parameter can be used to set a maximum length on the returned result. The default value for maximum length is 1024. If the call fails, FALSE is returned.
<?php
$filename = "test.txt";
// open a file for reading and writing
$logfile = fopen($filename, "w+");
// write a line with html in it
fputs($logfile, "<b>Hello world</b>");
// move back to the beginning of the file and read a line
fseek($logfile, 0);
$line = fgetss($logfile, 1024);
print "First line of $filename is: $line";
?> First line of test.txt is: Hello world This example shows that fgetss() removes html tags from the text it reads.