Solved

string manipulation

Posted on 2013-01-30
1
215 Views
Last Modified: 2013-01-30
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
Comment
Question by:yaron89
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
trevoC earned 500 total points
ID: 38837744
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question