RE: [PHP] How to access arrays from $GLOBAL?
| From: | Ford, Mike [LSS] | Date: | Wed, 13 Mar 2002 16:52:18 +0000 |
| Subject: | RE: [PHP] How to access arrays from $GLOBAL? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-88367@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Richard Davey [mailto:rich@fatal-design.com]
> Sent: 13 March 2002 16:02
>
> I have a global array $mtxt that is created in my script.
> I have a function from which I want to access a value from that array:
>
> $mtxt[1] = "Test";
> $text = $GLOBALS['mtxt[1]'];
>
> Except that gives me the Warning "Undefined index";
>
> I can use $GLOBALS['mtxt'] to access a global variable
> without an error,
> just not a specific element of a global array.
> Does anyone know the correct syntax for this?
$GLOBALS['mtxt'][1]
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211