1
$dizi = array(
"tr" => "Turkey",
"uk" => "United Kingdom",
"us" => "United States"
);

i want to add "br"=>"brasil" to end of the array.

thanks.

1

3 Answers 3

5

There's nothing to it:

$dizi['br'] = 'brasil';
Sign up to request clarification or add additional context in comments.

Comments

1

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).

Comments

1

you could just do:

$dizi['br'] = "brasil"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.