$bookA = \"123\"; $crack = \"A\";
I want to do something similar to this:
echo $book$crack;
Such that the output is 123
This will work:
$bookA = "123";
$crack = "A";
$var = "book$crack";
echo $$var;
You might want to use an associative array.
For instance:
$book = array();
$book["A"] = "Some Book";
$crack = "A";
//Later
echo $book[$crack];
These are called variable variables, but you should use arrays instead.
echo ${"book" . $crack};
Try the following:
echo ${book.$crack};
It works for me.
$varname = 'book'.$crack;
echo $$varname;