PHP explode Function
The explode function in PHP is used to split a string into multiple strings based on the specified delimiter. It is similar to the split function in Perl. Earlier versions of PHP had its own version of the split function, but it was deprecated as of PHP 5.3.0 and removed from PHP altogether as of 6.0.0. Using the split function in PHP is strongly discouraged.
The syntax of the explode function is:
explode ('delimiter', 'string', [limit])
delimiter is the string (can be one or more characters) used to split string. [limit] is an optional parameter and has the following values:
> 0: Returns an array with a maximum of limit element(s).
< 0: Returns an array except for the last -limit element(s).
0: Returns an array with 1 element.
Let's take a look at the examples below:
print_r (explode (',','one,two,three'));
Array (  => one  => two  => three )
$var = 'Learn PHP';
print_r (explode (' ',$var));
Array (  => Learn  => PHP )
print_r (explode (',','one,two,three',2));
Array (  => one  => two,three )