If your call to the function is:  print get_current_page_name()
then you are getting the expected results, a description of the returned
value.

Change your call to: $myarrray = get_current_page_name();

Then iterate through $myarray to print each value;

-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 3:56 PM
To: PHP
Subject: [PHP] how a function 'return' statement works



Can anyone give my puny mind an explanation as to why the following 
function only returns the value "Array" ?

# ===============================================================
# get_current_page_name()
# ---------------------------------------------------------------
# Returns the current document
#  Arguments
# -----------
# no arguments
# ===============================================================

function get_current_page_name()
{
    $current_page_name = explode("/", $_SERVER['PHP_SELF']);
    $current_page_name = array_slice($current_page_name, -1);
    return $current_page_name;
}

(I know this does the same thing as 'basename("$_SERVER['PHP_SELF'])', I 
just want to understand something a bit more fundamental to the way 
functions work)

Thanks,



Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

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

Reply via email to