Since: 8.0

interface Stringable (View source)

Stringable interface denotes a class as having a __toString() method.

Methods

string
__toString()

Magic method {https://www.php.net/manual/en/language.oop5.magic.php#object.tostring} allows a class to decide how it will react when it is treated like a string.

Details

string __toString()

Magic method {https://www.php.net/manual/en/language.oop5.magic.php#object.tostring} allows a class to decide how it will react when it is treated like a string.

Return Value

string

Returns string representation of the object that implements this interface (and/or "__toString" magic method).