Page 1 of 1

breaking up a string

Posted: Sat Sep 30, 2006 5:38 am
by speedy33417
What is the best way to break up a string separated by a certain character. I have path saved in $path which could me something like this:
folder1/folder2/folder3/

I'd like to break up the string into
folder1
folder2
folder3

and save it into an array.

Any suggestions would be great.

Posted: Sat Sep 30, 2006 5:39 am
by Oren

Posted: Sat Sep 30, 2006 5:42 am
by speedy33417
Cheers. Exactly what I was looking for.

Posted: Sun Oct 01, 2006 11:46 am
by speedy33417
Exploding my string will give me unpredictable amount of pieces. How do I find out how many pieces I got?

Code: Select all

$pieces = explode("/", $path);
Thanks.

Posted: Sun Oct 01, 2006 11:53 am
by impulse()
Try

Code: Select all

count()