manage a string for take namefile

if by PHP_SELF
I have some similar:
/localhost/namefile.php
is possible to extract only this :
namefile.php

(is possible also have only namefile -no extension-)

or is there a specific function?
artev [ Mi, 03 Oktober 2007 03:10 ] [ ID #1835054 ]

Re: manage a string for take namefile

"artev" <mailnotspammm [at] notspamm.nn> wrote in message
news:fg6v3b3760c9.4su5n243fc2h.dlg [at] 40tude.net...
> if by PHP_SELF
> I have some similar:
> /localhost/namefile.php
> is possible to extract only this :
> namefile.php
>
> (is possible also have only namefile -no extension-)
>
> or is there a specific function?

pathinfo
Steve [ Mi, 03 Oktober 2007 03:48 ] [ ID #1835058 ]

Re: manage a string for take namefile

artev wrote:
> if by PHP_SELF
> I have some similar:
> /localhost/namefile.php
> is possible to extract only this :
> namefile.php

pathinfo()
http://www.php.net/manual/en/function.pathinfo.php

> (is possible also have only namefile -no extension-)
>
> or is there a specific function?

basename(), if you know the extention
http://www.php.net/manual/en/function.basename.php

list($filename,$extension)=explode('.',$file);
if you are sure there is only one '.' in the files name.

--

//Aho
Shion [ Mi, 03 Oktober 2007 18:34 ] [ ID #1835191 ]
PHP » alt.php » manage a string for take namefile

Vorheriges Thema: redirect at other link page
Nächstes Thema: Unix Paths question