Re: [PHP] how a function 'return' statement works

2002-02-14 Thread Erik Price
Hm... I tried quite a few variations on this. I can't seem to get any displayable value out of this function. function get_current_page_name() { $current_page_name = explode(/, $_SERVER['PHP_SELF']); $current_page_name = $current_page_name[-1]; return $current_page_name ; } $errorcode =

RE: [PHP] how a function 'return' statement works

2002-02-14 Thread Alastair Battrick
Do you not have to make $_SERVER a global variable in the function ? Alastair Lightwood Consultancy Ltd Hm... I tried quite a few variations on this. I can't seem to get any displayable value out of this function. function get_current_page_name() { $current_page_name = explode(/,

Re: [PHP] how a function 'return' statement works

2002-02-14 Thread Aaron Gould
] Sent: Thursday, February 14, 2002 10:46 AM Subject: RE: [PHP] how a function 'return' statement works Do you not have to make $_SERVER a global variable in the function ? Alastair Lightwood Consultancy Ltd Hm... I tried quite a few variations on this. I can't seem to get any displayable

Re: [PHP] how a function 'return' statement works

2002-02-14 Thread DL Neil
Erik, function get_current_page_name() { $current_page_name = explode(/, $_SERVER['PHP_SELF']); $current_page_name = $current_page_name[-1]; return $current_page_name ; } $errorcode = get_current_page_name(); echo $errorcode; The only thing that works is $errorcode =

RE: [PHP] how a function 'return' statement works

2002-02-14 Thread Matt Schroebel
How about: return $current_page_name[count($current_page_name)-1]; -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Can anyone give my puny mind an explanation as to why the following function only returns the value Array ? #

Re: [PHP] how a function 'return' statement works

2002-02-14 Thread Lars Torben Wilson
On Thu, 2002-02-14 at 07:32, Erik Price wrote: Hm... I tried quite a few variations on this. I can't seem to get any displayable value out of this function. function get_current_page_name() { $current_page_name = explode(/, $_SERVER['PHP_SELF']); $current_page_name =

Re: [PHP] how a function 'return' statement works

2002-02-14 Thread Erik Price
On Thursday, February 14, 2002, at 10:46 AM, Alastair Battrick wrote: Do you not have to make $_SERVER a global variable in the function ? $_SERVER is global AFAIK, but good thinking. All $_* variables are global (unlike the $HTTP_*_VARS arrays). Erik Erik Price Web Developer

Re: [PHP] how a function 'return' statement works

2002-02-14 Thread Erik Price
On Thursday, February 14, 2002, at 02:32 PM, Lars Torben Wilson wrote: I think what you're trying to do is return one particular element out of the array. If that's the case, just use something like: return $current_page_name[-1] to return the last element in the array. I do not know

RE: [PHP] how a function 'return' statement works

2002-02-13 Thread Rick Emery
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

RE: [PHP] how a function 'return' statement works

2002-02-13 Thread Darren Gamble
Good day, You're returning $current_page_name. $current_page_name is set to the return value for array_slice. And array_slice returns an array. So, $current_page_name will be an array. So, you'll always return an array. I think what you're trying to do is return one particular element out

Re: [PHP] how a function 'return' statement works

2002-02-13 Thread Gerhard Hoogterp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 13 February 2002 22:55, Erik Price wrote: Can anyone give my puny mind an explanation as to why the following function only returns the value Array ? # === #