NYCPHP Meetup

NYPHP.org

[nycphp-talk] Variable composition: ${'foo'.$i}

justin justin at justinhileman.info
Sun Feb 2 12:36:29 EST 2014


ᐧ

On Fri, Jan 31, 2014 at 12:11 PM, Anthony Ferrara <ircmaxell at gmail.com>wrote:

> In short, the only form of variable-variables that I believe should
> **ever** be used are variable object property/method references:
>
> $obj->$property = blah;
> $obj->$method();
>
> Any other usage is simply mis-using variables where you should use a more
> appropriate data structure (like an array or object)...
>

I'd add:

new $className(...);

--j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20140202/2edc6b07/attachment.html>


More information about the talk mailing list