Hello!
In the last tutorial where I showed you how to create an arrays (view here), but in this tutorial I’m going to show how to add values to array keys.
There are many ways to do it. First I’m going to show to how to do it manually. It looks like this.
$arr = array(“key”=>”value”, “key2″=>”value2″);
It’s really good way to hold data in an array. I’m going to use myself in an example:
$arr = array(“name”=>”Jaan”, “weight”=>”83kg”, “height”=>”183cm”);
Second way to add values to your array is using array_merge() function which will merge 2 arrays. It goes like this: