PHP - Variable inside variable?

前端 未结 6 1140
梦毁少年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条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-18 07:29

    Try the following:

    echo ${book.$crack};
    

    It works for me.

提交回复
热议问题