string manipulation

How do I cut the following string in order to get the file name (i.e. 24.swf)

Who is Participating?
trevoCConnect With a Mentor Commented:
Here you go

string basename ( string $path [, string $suffix ] )

Open in new window

so basename takes a string that is a path and returns just the filename portion.

you could use the suffix portion of the above example to chop off the .swf part if you like or not use that option at all to return 24.swf

dirString = "folNo1/stuff/swf/24.swf";
fileNameOnlyString = basename(dirString);
//fileNameOnlyString contains 24.swf

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.