

- 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_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 )
- Related Questions & Answers
- Split string into sentences using regex in PHP
- PHP – mb_ereg_replace() function – Replace regular expression with multibyte support
- Explain the module function to split ABAP date?
- PHP preg_split to split a string with specific values?
- What are the difference between split ups and split offs?
- Split List in C++
- Search a string in Matrix Using Split function in Java
- Split Button Dropdowns with Bootstrap
- Split a string in Java
- Java String split() method example.
- Custom list split in Python
- Split string into groups - JavaScript
- Split Concatenated Strings in C++
- What is split in divestiture?
- Split String with Dot (.) in Java
Advertisements