The explode()
and split()
functions are used in PHP to split the strings. Both are defined here:
Split()
is used to split a string into an array using a regular expression whereas explode()
is used to split the string by string using the delimiter.
Example of split() :
split(":", "this:is:a:split"); //returns an array that contains this, is, a, split.
Output : Array ([0] => this,[1] => is,[2] => a,[3] => split)
Example of explode() :
explode ("take", "take a explode example "); //returns an array which have value "a explode example"
Output : array([0] => "a explode example")