| 
	
 | 
 Posted by Ian Hobson on 10/03/07 10:09 
artev wrote: 
> 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? 
 
First thing to do is to get clear on what EXACTLY you want to do. This  
helps in programming tremendously. 
 
If you want to extract everything following the last "/" up to, but not  
including the next ".", then look up regular expressions and preg_match  
in the manual. 
 
If you want to divide the string up at every "/" and take the last, look  
up "explode" and "count" in the manual. 
 
But I would actually start by understanding what $_SERVER['PHP_SELF']  
returns.  This is a predefined variable, and you can find it under that  
name in the manual. 
 
Regards 
 
Ian
 
  
Navigation:
[Reply to this message] 
 |