Re: Function effecting global array.
| From: | Noodle Snacks | Date: | Sun, 20 Oct 2002 11:12:00 +0000 |
| Subject: | Re: Function effecting global array. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120662@lists.php.net to get a copy of this message | ||
thanks
"Jason Wong" <php-general@gremlins.com.hk> wrote in message
news:200210201847.06853.php-general@gremlins.com.hk...
> 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 ?
> */
>