Re: getting a filename [with no extension] out of a url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Friday, July 1, 2005, 9:54:42 AM, you wrote:
GA> if  $_SERVER['SCRIPT_NAME'] give this....
GA> /folder/folder/Library/php/filename.php

GA> what would be the proper way to strip the string until only 'filename'
GA> is left
GA> I'm a bit new at eregi stuff

GA> any help would be appreciated
GA> many thanks

GA> g


I do this:
$file = '/folder/folder/Library/php/filename.php';
$ext = @substr($file, (@strrpos($file, ".") ? @strrpos($file, ".") + 1 : @strlen($file)), @strlen($file));
$fname = basename($file,$ext);

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux