mb_eregi()
mb_eregi() — Regular expression match ignoring case with multibyte support.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
mb_eregi(string $pattern, string $string, array &$matches = null): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $pattern | string | The regular expression pattern. |
| $string | string | The string being searched. |
| &$matches | array | If matches are found for parenthesized substrings of pattern and the function is called with the third argument matches, the matches will be stored in the elements of the array matches. If no matches are found, matches is set to an empty array. |
Return value
Returns whether pattern matches string.
Example
The PHP manual ships no example for mb_eregi(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.0.0 | This function returns true on success now. Previously, it returned the byte length of the matched string if a match for pattern was found in string and matches was passed. If the optional parameter matches was not passed or the length of the matched string was 0, this function returned 1. |
| 7.1.0 | mb_eregi() will now set matches to an empty array, if nothing matched. Formerly, matches was not modified in that case. |
See also
mb_regex_encoding(), mb_ereg()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page mb_eregi() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.