What is the difference between split() and explode()?

Nov 04, 2013, by admin

Hi all today the thing we going to see in the post is the difference between split() and explode()?

a large string.

The split() function splits the string into an array using a regular expression and returns an array.
Ex: split (:India:Nepal:Srilanka); returns an array that contains India, Nepal, Srilanka.

The explode () function splits the string by string.
Ex: explode (and India and Nepal and Srilanka); returns an array that contains India, Nepal, Srilanka.

Have a look by below example.
split (“:”, “i:am:reading:Bugtreat Blog”);

returns an array that contains i,am,reading,scriptarticle.com.

The explode () function splits the string by string.
explode (“I”, “I am reading Bugtreat Blog”);

returns an array that contains

array (
0 => ”,
1 => ‘ am reading Bugtreat Blog’,
)

Note: split () function has been DEPRECATED as of PHP 5.3.0.

Hope the post will be useful to get more updates like the page Bugtreat Technologies to get updates of our latest cs cart templates like the page Cs Cart Templates