Re: how to make a global scope array
| From: | Jack Lee | Date: | Sat, 26 Jul 2003 14:42:23 +0000 |
| Subject: | Re: how to make a global scope array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156961@lists.php.net to get a copy of this message | ||
It works! Thanks guys!
"David Nicholson" <me@djnicholson.com> wrote in message
news:8f831227b0eb6c6d09a0555531365933@home.djnicholson.com...
Hello,
This is a reply to an e-mail that you wrote on Fri, 25 Jul 2003 at
23:51, lines prefixed by '>' were originally written by you.
> <20030725224852.1123.qmail@pb1.pair.com>
> Jack Lee:
> > //I have an array a[] like this:
> > <?php
> > $a[]=0;
> > //How to define and use it in a function like this?
> > function myfunc(something)
> > {
> > echo $a[0]; //got error here!!!! Notice: Undefined
variable:
> > }
> > //Thanks for any help.!!!
> global $a;
.. or echo $GLOBALS['a'][0];
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)