View Full Version : Removing part of a var

09-05-2011, 01:19 PM
Hi there,

I have a var which will be something like:


I need a way of later cutting down this the "./xml/" from this var so it is simply:

Is this possible?


09-05-2011, 01:47 PM
Never mind, Noob here hadn't used explode before. Thanks all.

Chris Hick
09-05-2011, 01:48 PM
Well, you could use the str_replace function in php.

$remove = './xml/';
$filename = './xml/filename.xml';
$newfilename = trim(str_replace($remove,' ', $filename));

09-05-2011, 02:08 PM
If all values of your variable is a valid file path, you can just use basename

echo basename('./xml/filename.xml'); //should return filename.xml

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum