- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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_split (Multibyte Split) function
The mb_split() function in PHP is used to split a multibyte string using regular expressions. It returns the results in an array format.
Syntax
array mb_split($str_pattern, $str_string, int $limit=-1)
Parameters
mb_split() accepts the following three parameters −
$str_pattern − It is used for the regular expression's pattern.
$str_string − It is used to split the string.
$limit − It is an optional parameter that is used to specify the limit elements.
Return Values
The mb_split function will return the split elements result as an array. Or, it will return False on failure.
Example 1
<?php mb_internal_encoding("UTF-8"); //mb_split function will split the string $string = mb_split( "[ ,]+", // Pattern "Welcome to the PHP Tutorial"); // string print_r($string); ?>
Output
It will produce the following output −
Array ( [0] => Welcome [1] => to [2] => the [3] => PHP [4] => Tutorial )
Advertisements
To Continue Learning Please Login
Login with Google