PHP fgetss() Function

❮ PHP Filesystem Reference

Example

Read one line from the open HTML file (strip tags):

<?php
$file = fopen("test.htm","r");
echo fgetss($file);
fclose($file);
?>
Run Example »

Definition and Usage

The fgetss() function returns a line from an open file - stripped from HTML and PHP tags.

Note: The fgetss() function is deprecated from PHP 7.3.

Syntax

fgetss(file, length, tags)

Parameter Values

Parameter Description
file Required. Specifies the open file to return a line from
length Optional. Specifies the number of bytes to read. Reading stops when length-1 bytes have been reached, or a when a new line occurs, or on EOF. Note: This parameter is required in versions prior to PHP 5
tags Optional. Specifies which tags that will not be removed


Technical Details

Return Value: A single line read from the file on success, FALSE on EOF or error
PHP Version: 4.0+

❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.