The PHP manual for
This function has been DEPRECATED as
of PHP 5.3.0. Relying on this feature
is highly discouraged…Use
But I can’t find a difference between
join() hasn’t been deprecated, so what gives?
It’s been deprecated because
explode()is substantially faster because it doesn’t split based on a regular expression, so the string doesn’t have to be analyzed by the regex parser
preg_split()is faster and uses PCRE regular expressions for regex splits
implode() are aliases of each other and therefore don’t have any differences.
split() you can use regular expressions to split a string. Whereas
explode() splits a string with a string.
preg_split is a much faster alternative, should you need regular expressions.
Both the functions are used to Split a string.
However, Split is used to split a string using a regular expression.
On the other hand, Explode is used to split a string using another string.
E.g explode (” this”, “this is a string”); will return “Is a string”
E.g Split (” + “, “This+ is a string”);
Both are used to split a string into an array, but the difference is that
split() uses pattern for splitting whereas
explode() uses string.
explode() is faster than
split() because it doesn’t match string based on regular expression.
split() function splits the string into an array using a regular expression and returns an array.
explode() function splits the string by string.
<?php $split_array=split(':','I:P:S'); $explode_array=explode('and','I and P and S'); print_r($split_array); print_r($explode_array); ?>
The result will be
Array (  => I  => P  => S ) Array (  => I  => P  => S )
Note:The function split() was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0