3 ms·
I still don't know how I feel about the fact that in PHP $$var (a) works, and (b) does exactly what you'd expect.
by andreareina 4y ago
I still don't know how I feel about the fact that in PHP $$var (a) works, and (b) does exactly what you'd expect.
- klyrs 4y agoEarly days of PHP were total madness. GET vars initialized variables in the global namespace. Uninitialized variables treated as zero/empty string. People were rolling their own query sanitizers in the best case. Misconfigured servers often horked out script sources. Why not pour some gas on it with variable variables?
- b3morales 4y agoThis level of introspection can be useful in some cases. Perhaps the flaw is just in giving it such simple, attractive syntax.
- klyrs 4y agoI think so. You can get at the __globals__ dict in python to similar effect, and I've rarely seen that abused.