Is there any way at all to make a variable work like echo, as such:
$x = "echo";
$x "Hi there!";
If you understand what I mean? I've seen it done before only the variable was "system" and the code was
//taking $x = "system"
$x(blablabla);
Any ideas?
From the notes on echo
's manual page:
Note: Because this is a language construct and not a function, it cannot be called using variable functions.
If you insist, you could say like eval "$x \"stuff\";";
, but other than that or creating a function and using it instead, you're kinda out of luck.
You mean like this:
$x = 'printf';
$x('Hi there');
?
echo
is a language construct, not a function, so it won't work