> -----Original Message-----
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: 14 February 2002 20:40
> 
> here is the final function:
> 
> # ===============================================================
> # get_current_page_name()
> # ---------------------------------------------------------------
> # Returns the current document
> #  Arguments
> # -----------
> # no arguments
> # ===============================================================
> 
> function get_current_page_name()
> {
>       $current_page = $_SERVER['PHP_SELF'];
>       $current_page_name = explode("/", $current_page);
>       $pagename = array_slice($current_page_name, -1, 1);
>       return $pagename[0];
> }

In place of the array_slice, why not use (the more readable) end($current_page_name)?  
And why not just return that directly, rather than assigning it to an intermediate 
variable that you're not using for anything else?

Actually, I'd probably ask the same about all your intermediate results -- I'd 
probably have written this whole thing as a single statement, thus:

      return end(explode("/", $_SERVER['PHP_SELF']));

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

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

Reply via email to