Re: Variable representation
| From: | tamouse mailing lists | Date: | Mon, 02 Apr 2012 21:29:14 +0000 |
| Subject: | Re: Variable representation | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317432@lists.php.net to get a copy of this message | ||
On Mon, Apr 2, 2012 at 4:34 AM, Maciek Sokolewicz
<maciek.sokolewicz@gmail.com> wrote:
> Usually if you think you need to use eval: think again. In this case, it
> again holds true.
>
> Instead of doing what you do, you can also reference the variable as:
> echo ${'image_'.$i};
> or
> echo $GLOBALS['image_'.$i];
>
> Both are preferable by far over using eval, with all its potential security
> concerns.
Oh, man, this is a great list. I didn't even *think* about doing it that way.