String representation of object

- « Serializable

- Serializable::unserialize »

- PHP Manual
- Serializable
- String representation of object

# Serializable::serialize

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

Serializable::serialize — String representation of object

### Description

public Serializable::serialize(): ?string

Should return the string representation of the object.

### Parameters

This function has no parameters.

### Return Values

Returns the string representation of the object or `null`

### Errors/Exceptions

Throws Exception when returning other types than strings and `null`.

### See Also

- __sleep()
- __serialize()