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.
breaking up a string
Moderator: General Moderators
- speedy33417
- Forum Contributor
- Posts: 128
- Joined: Sun Jul 23, 2006 1:14 pm
- speedy33417
- Forum Contributor
- Posts: 128
- Joined: Sun Jul 23, 2006 1:14 pm
Exploding my string will give me unpredictable amount of pieces. How do I find out how many pieces I got?
Thanks.
Code: Select all
$pieces = explode("/", $path);-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
Try
Code: Select all
count()