interface Stringable (View source)

The Stringable interface denotes a class as having a toString() method. Unlike most interfaces, Stringable is implicitly present on any class that has the magic toString() method defined, although it can and should be declared explicitly.

Its primary value is to allow functions to type check against the union type string|Stringable to accept either a string primitive or an object that can be cast to a string.

Methods

string
__toString()

String representation of the object.

Details

string __toString()

String representation of the object.

Return Value

string

String representation of the object