$bookA = "123"; $crack = "A";
I want to do something similar to this:
echo $book$crack;
Such that the output is 123.
What is the correct syntax for the echo command?
Thanks.
$bookA = "123"; $crack = "A";
I want to do something similar to this:
echo $book$crack;
Such that the output is 123.
What is the correct syntax for the echo command?
Thanks.
These are called variable variables, but you should use arrays instead.
You might want to use an associative array.
For instance:
$book = array();
$book["A"] = "Some Book";
$crack = "A";
//Later
echo $book[$crack];
This will work:
$bookA = "123";
$crack = "A";
$var = "book$crack";
echo $$var;