

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP – mb_eregi_replace() function
In PHP, mb_eregi_replace() is used to replace a regular expression with a multibyte support, ignoring case. This function will scan the string for matches to the pattern, then it will replace the matched text with the replacement. This function is supported in PHP 4.2 or higher version.
Syntax
string mb_eregi_replace(str $pattern, str $replacement, str $string, str $options)
Parameters
mb_eregi_replace() accepts the following four parameters −
$pattern − This parameter is used for the regular expression pattern and it may be used multibyte characters. The case will be ignored.
$replacement − This parameter is used for text replacement.
$string − The string parameter is used to search the string.
$options − It is used for the search option.
Return Values
mb_eregi_replace() will return the resultant string on success or it will return an error. It will return an error if the string is not valid for the current encoding.
Example
<?php //encoding = "UTF-8" $re=mb_regex_encoding("UTF-8"); //The mb_eregi_replace function will replace //the 'p' to 'P' characters $string=mb_eregi_replace("[p]","P","pHp Tutorial"); var_dump($re); var_dump($string); ?>
Output
bool(true) string(12) "PHP Tutorial"
- Related Questions & Answers
- PHP – mb_ereg_replace() function – Replace regular expression with multibyte support
- Calculating byte values to megabyte (MB) in MySQL?
- PHP abs() Function
- PHP acos() Function
- PHP acosh() Function
- PHP asin() Function
- PHP asinh() Function
- PHP atan() Function
- PHP atan2() Function
- PHP atanh() Function
- PHP base_convert() Function
- PHP bindec() Function
- PHP ceil() Function
- PHP cos() Function
- PHP cosh() Function
- PHP decbin() Function