Page 1 of 1
can "input" resolve a variable
Posted: 29 Jan 2019 13:38
by yusef88
Code: Select all
$a = "test";
$s = input("", "",""); // input $a
echo $s;
can the "input" command resolve the variable $a ?
Re: can "input" resolve a variable
Posted: 29 Jan 2019 13:42
by highend
No, eval() is necessary for doing such a thing
Code: Select all
$a = "test";
$s = input("", "", '$a');
echo eval($s);
Re: can "input" resolve a variable
Posted: 29 Jan 2019 16:15
by yusef88
Thanks for help
is it possible to get control key also?
Re: can "input" resolve a variable
Posted: 29 Jan 2019 16:31
by Filehero
yusef88 wrote: ↑29 Jan 2019 16:15
is it possible to get control key also?
Re: can "input" resolve a variable
Posted: 29 Jan 2019 17:30
by yusef88
@Filehero
thanks
Re: can "input" resolve a variable
Posted: 29 Jan 2019 17:38
by PeterH
Shorter for eval($s) is *$s
But look out: in both cases $s
should contain a valid variable name!
Edit: replaced must by should