좋은 하루,PHP, 변수 이름으로 문자를 사용하는 방법?
현재 변수 안에 저장된 문자를 사용하여 이름별로 다른 변수를 호출하는 방법을 알아 내려고하고 있습니다. 예 :
$string = "ABCD";
$A = 10;
echo //Here I want to get $string[0]'s value, which will be A, then echo the value of the variable named after $string[0]'s value, $A. So in other words the output of the echo should be 10.
질문에 대해 명확하지 않은 경우 알려주십시오.
'$ 에코 {$ 문자열을 [0]};'? – Darren
echo $$ string [0] – verhie
논리를 variable_의 _variables라고하며 여기에서 @Darren이 올바른 것입니다. –