Dears,
Which php function can convert a string into variable?
Sincerely yours, Simon
Just assign the value to a variable:
$a="hello";
I think he wants to then use "hello" as $hello... maybe not, but if so, just use the double $$, like this:
$a = "hello"; $hello = "hi";
echo $$a; (this will output "hi")
You can use the following syntax...
${"string"}
For example say I have variables $Q1 to $Q20 I want printed, I could use the following...
$i = 1; while ($i < 21) { $var = ${"Q" . $i}; print($var); $i++; }
Hopefully that helps, Jeff Pristelski
This was awesome man....i really needed this code... thanks for your help...even though you had not intended on helping me...just a littl thanks...
PeAcE