PHP string assign to array variable -


i have written php code, trying assign string (tag_of_organization) variable , latter assign array newvar. totally new php , search lot cannot find anything, asking here how this. here is

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

you correct. put print_r test print 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 )  

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -