PHP - Variable inside variable?

前端 未结 6 1110
梦毁少年i
梦毁少年i 2021-01-18 07:00

$bookA = \"123\"; $crack = \"A\";

I want to do something similar to this:

echo $book$crack;

Such that the output is 123

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 07:08

    This will work:

    $bookA = "123";
    $crack = "A";
    $var = "book$crack";
    echo $$var;
    

提交回复
热议问题