PHP字符串赋值给数组变量[关闭]

I have written some php code, trying what is to assign a string (tag_of_organization) to a variable and then latter to assign it to array newvar. As i am totally new to php and search a lot for it but cannot find anything, so i am asking it here how to do this. here it is

$organ='tag_of_organization';  
$newvar = array(); 
$newvar["tag_of_organization"] =$organ;

You are already correct. put print_r to test print your array

$organ='tag_of_organization';  
$newvar = array(); 
$newvar["tag_of_organization"] =$organ;
print_r($newvar);

Output

Array ( [tag_of_organization] => tag_of_organization ) 

Update

you want dynamic result

$organ='tag_of_organization';  
$newvar = array(); 
$newvar[$organ] =$organ;
print_r($newvar);

Output

Array ( [tag_of_organization] => tag_of_organization ) 

Try with:

$newvar[$organ] = $organ;