I’m having difficulty adding to the end of an array. Not sure how to do it. Please help.
$person = array();
$person = array("name"=>"tom", "age"=>20, "height"=>180);
How do I add to the end of an array? I want to add “weight”=>120 to the end of an existing array.
Thanks
Since this is an associative array, just do:
For regular numerically indexed arrays, you can use
array_push()or$person []= "new value";.