RE: [PHP] get name of file
| From: | Thor M. Steindorsson | Date: | Tue, 20 Mar 2001 03:13:08 +0000 |
| Subject: | RE: [PHP] get name of file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44677@lists.php.net to get a copy of this message | ||
> How do I return the name of a file without any extensions or path info.
> Eg how do I return "about" from
> "http://www.domainz.com/about.htm".
Here's a quick and dirty way:
<?
$url = "http://www.domainz.com/about.htm";
$url = explode("/",$url);
$num = count($url);
$name = explode(".",$url[($num-1)]);
$documentname = $name[0];
echo "$documentname";
?>
> -----Original Message-----
> From: Matthew Delmarter [mailto:matt@adplusonline.com]
> Sent: Monday, March 19, 2001 6:52 PM
> To: PHP Mailing List
> Subject: [PHP] get name of file
>
>
> How do I return the name of a file without any extensions or path info.
>
> Eg how do I return "about" from
> "http://www.domainz.com/about.htm".
>
> Regards,
>
> Matthew Delmarter
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>