Re: Function effecting global array.
| From: | Jason Wong | Date: | Sun, 20 Oct 2002 10:47:06 +0000 |
| Subject: | Re: Function effecting global array. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120661@lists.php.net to get a copy of this message | ||
On Sunday 20 October 2002 18:14, Noodle Snacks wrote:
> I want to write a function that will add to the end of an array that can be
> accessed elsewhere.
>
> To make the array variable global I just do this don't i?
>
> function my_function($foo){
> global $arrayoffoos;
>
> etc....
> }
Yes.
Or you can address it directly through $GLOBALS:
function my_function($foo){
$GLOBALS['arrayoffoos'][] = $foo; # or similar
}
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Ya'll hear about the geometer who went to the beach to catch some
rays and became a tangent ?
*/