Hi friends,
I want to know that What is the difference between Split and Explode?
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Dec 21, 2011, 4:03 PM
http://www.javatalks.com/
Sam HobbsPosted Dec 21, 2011, 3:53 PM
I think it would be better to use the General forum instead of the ASP forum. Whatever forum is used, it will help if the language is specified when it is not the language that is this web site's namesake (the language that this web site is named for). This specific thread could have saved me time if it was specified as being a PHP question.
VulpesPosted Dec 21, 2011, 3:30 PM
Sam HobbsPosted Dec 21, 2011, 2:31 PM
Satyapriya NayakPosted Dec 21, 2011, 12:35 PM
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"
Split (" + ", "This+ is a string")
The split() function splits the string into an array using a regular expression and returns an array.
The explode() function breaks a string into an array.
ex
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
?>
output
[0] => Hello
[1] => world.
[2] => It's
[3] => a
[4] => beautiful
[5] => day.
Thanks