using array_push($var); with keys
$dizi = array(
"tr" => "Turkey",
"uk" => "United Kingdom",
"us" => "United States"
);
i want to add "br"=>"brasil"
to end of the array.
t开发者_开发知识库hanks.
There's nothing to it:
$dizi['br'] = 'brasil';
A syntax construct that's a bit closer to array_push
would be:
$dizi += array("br" => "Brasil");
Note the +=
But for a single addition you should prefer the direct array assignment (as pointed out in the other answers).
you could just do:
$dizi['br'] = "brasil"
精彩评论