Re:Executing non-alphanumeric JavaScript without parentheses
by nubs on Friday July 15, 2016 @12:16PM
(#12102036)
I've done something similar with PHP, by casting an array to a string (The string "Array") and using "variable variables". If only there was a way to call functions in PHP without using letters in the code... https://gist.github.com/nubs/5849633#file-nodigitsorquotesei...
[ Parent
| on HN ]
Re:Executing non-alphanumeric JavaScript without parentheses
by TazeTSchnitzel on Friday July 15, 2016 @01:30PM
(#12102558)
You can call a function by name:
$foo = "file_get_contents";
$bar = "http://example.com/";
$baz = $foo($bar);
In PHP 7 this doesn't even require you to give the function name its own variable: ("file_get_contents")("http://example.com/");