string manipulation

A

Anonymous

Guest
Code:
<?
$string = 'N:\NML\Perseus\Photographs\procedure pictures\02-08-02\07 Hardware attaching control panel.JPG';
$values = explode("\\",$string);
list($filename) = explode(".",$values[sizeof($values)-1]);
print $filename;
?>

Note that the string being enclosed in single quotes is not accidental or coincedental. I enclosed it in single quotes otherwise it will parse the '\' as a special character and the script won't work. The rest should be fairly self explanatory.
 
Back
Top