php8.5
Home/ Manual/ spl / splfileobject/ SplFileObject::__toString

SplFileObject::__toString

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Returns the current line as a string

Description

SplFileObject::__toString(): string

This method will return the current line as a string.

Parameters Parameters

Return Values

Returns the current line as a string.

Changelog

VersionDescription
8.1.14, 8.2.1Changed from an alias of SplFileObject::fgets to an implementation of SplFileObject::current which returns a CSV string when the SplFileObject::READ_CSV flag is set.
7.2.19, 7.3.6Changed from an alias of SplFileObject::current to an alias of SplFileObject::fgets.

Source: reference/spl/splfileobject/tostring.xml · from the official PHP manual (php/doc-en)