Solved

string manipulation

Posted on 2013-01-30
1
204 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now