php8.5
Home/ Manual/ bson / regex/ MongoDB\BSON\Regex::__toString

MongoDB\BSON\Regex::__toString

PHP function Edit on GitHub ✎

(mongodb >=1.0.0)

Returns the string representation of this Regex

Description

MongoDB\BSON\Regex::__toString(): string

Parameters Parameters

Return Values

Returns the string representation of this Regex.

Examples

MongoDB\BSON\Regex::__toString() example

php
<?php

$regex = new MongoDB\BSON\Regex('regex', 'i');
var_dump((string) $regex);

?>

The above example will output:

output
string(8) "/regex/i"

See Also

  • BSON Types

Source: reference/mongodb/bson/regex/tostring.xml · from the official PHP manual (php/doc-en)