Serialize a Regex

- « MongoDB\BSON\Regex::jsonSerialize

- MongoDB\BSON\Regex::__toString »

- PHP Manual
- MongoDB\BSON\Regex
- Serialize a Regex

# MongoDB\BSON\Regex::serialize

(mongodb >=1.2.0)

MongoDB\BSON\Regex::serialize — Serialize a Regex

### Description

final public MongoDB\BSON\Regex::serialize(): string

### Parameters

This function has no parameters.

### Return Values

Returns the serialized representation of the MongoDB\BSON\Regex.

### Errors/Exceptions

- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.

### See Also

- MongoDB\BSON\Regex::unserialize() - Unserialize a Regex
- serialize() - Generates a storable representation of a value
- Serializing Objects