whta is the difference between explode() and split()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
swetha
Forum Commoner
Posts: 88
Joined: Wed Sep 10, 2008 11:00 pm

whta is the difference between explode() and split()

Post by swetha »

hi,
can anyone tell me the difference clearly between split() and explode() functions in php?


thanks
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: whta is the difference between explode() and split()

Post by pcoder »

Split() splits string into array by regular expression.
It is faster to use explode(), which does not take the overhead of regular expression.
It depends upon your requirement to use these functions.
For more details. Go through it:
http://www.php.net/manual/en/function.split.php
:)
keerthika
Forum Newbie
Posts: 10
Joined: Wed Nov 05, 2008 7:07 am

Re: whta is the difference between explode() and split()

Post by keerthika »

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.
Post Reply