RE: [PHP] makeing an array
| From: | Ford, Mike [LSS] | Date: | Thu, 02 Jan 2003 15:20:27 +0000 |
| Subject: | RE: [PHP] makeing an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129947@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Gerald Timothy Quimpo [mailto:gquimpo@sni-inc.com]
> Sent: 02 January 2003 14:12
>
> alternatively, if you don't want to change to array syntax,
> you can use
> variable variables. e.g.,
>
> $variable_name="comment_".nIndex; // now comment_1, for example.
> // assume that $comment_1 is "xxx111"
> echo $$variable_name ; // prints xxx111
echo ${'comment'.$nIndex}
works just as well.
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