Split and Explode

What is the difference between Split and Explode
No. Explode Split
1 Explode is used to split a string using another string. E.g explode("this","this is a string"); will return “Is a string” Split is used to split a string using a regular expression. Eg. Split (" + ", "This+ is a string")
2 The explode() function splits the string by string. Ex: explode(and India and Pakistan and Srilanka); returns an array that contains India, Pakistan, Srilanka. The split() function splits the string into an array using a regular expression and returns an array. Ex: split(:India:Pakistan:Srilanka); returns an array that contains India, Pakistan, Srilanka.
3 Both the functions are used to split a string. Both the functions are used to split a string.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>