![]() |
The mb_ereg_search_pos() is an inbuilt function in PHP that is used in regular expressions to match a given string. It searches for the first occurrence of a pattern in the string and returns the starting position and the ending position of the match. Syntax:mb_ereg_search_pos( ?string $pattern = null, ?string $options = null ): array|false Parameters:This function accepts 2 parameters that are described below:
Return Value:The mb_ereg_search_pos() function returns an array that contains the position value of the first occurrence of the string. If the function successfully executes, it will return “true”, otherwise It will return “false”. Program 1: The following program demonstrates the mb_ereg_search_pos() Function. PHP
Output
Pattern is Found Program 2: The following program demonstrates the mb_ereg_search_pos() Function. PHP
Output
6 Program 3: The following program demonstrates the mb_ereg_search_pos() function PHP
Output
Match found: 'world! This is a sample tex' at positions 7-5. Reference: https://www.php.net/manual/en/function.mb-ereg-search-pos.php |
Reffered: https://www.geeksforgeeks.org
PHP |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |