+ 6
Change variable according to variable PHP
$type = username; $[$type] = ... I want to make the second variable the string of the first variable.
3 Respostas
+ 4
Here.
You reassign variable value using two $ marks and the variable name will change to the previous value.
$a = "username";
$a = "toni";
echo $username;
+ 2
Replace [] with {}:
${$type} = ...
Youre welcome :)
0
You have to write $type to get output of second variable