preg_split

PHP 4, PHP 5, PHP 7, PHP 8
preg_split - Split string by a regular expression

Example #1 preg_split example : Get the parts of a search string

Result: Array ( [0] => hypertext [1] => language [2] => programming )
PHP Version:

Example #2 Splitting a string into component characters

Result: Array ( [0] => s [1] => t [2] => r [3] => i [4] => n [5] => g )
PHP Version:

Example #3 Splitting a string into matches and their offsets

Result: Array ( [0] => Array ( [0] => hypertext [1] => 0 ) [1] => Array ( [0] => language [1] => 10 ) [2] => Array ( [0] => programming [1] => 19 ) )
PHP Version:


Example #4 of preg_split

PHP Version:


Function preg_split:

Regular Expressions (Perl-Compatible) Functions

Most used PHP functions