php – explode

$str = ‘one|two|three|four’;
print_r(explode(‘|’, $str, 2));
print_r(explode(‘|’, $str, -1));


This function returns an array of string.

 [0] => one
 [1] => two|three|four
In the above array the string is splited at the second position.
[0] => one
[1] => two
[2] => three
In this array, as their is negative limit used in the coding,
all components except the last limit are returned


  1. nani said


  2. balaji said

    thats good example

  3. ramesh said

    very good concepts

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: