Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

string manipulation

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

/folNo1/playFlash.php?game=dGames/home/swf/24.swf
0
yaron89
Asked:
yaron89
1 Solution
 
trevoCCommented:
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

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now