PHP – mb_ereg_search_init() function

PHPServer Side ProgrammingProgramming

The mb_ereg_search_init() function in PHP is used to setup string and regular expression pattern for a multibyte regular expression match. The values are used for mb_ereg_search_regs, mb_ereg_search_pos, and mb_ereg_search.

Syntax

bool mb_ereg_search_init(
   $str_string,
   $str_pattern=null,
   $str_options=null
)

Parameters

mb_ereg_search_init() accepts three parameters −

  • string − This is the search string.

  • pattern − This is the search pattern.

  • options − This is the search option. .

Return Values

mb_ereg_search_init() returns True on success and False on failure.

Example

<?php
   // UTF-8 Encoding
   $encoding=mb_regex_encoding("UTF-8");

   // String "PHP online tutorial"
   $bool = mb_ereg_search_init("PHP online tutorial", "[l]");
   var_dump($bool);
   var_dump($encoding);
?>

Output

bool(true)
bool(true)
raja
Updated on 12-Oct-2021 06:37:13

Advertisements