Solved

string manipulation

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
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.

778 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