PHP Basic Tutorial
You can add elements to the end of an array using the []
operator.
Try it yourself
To add items to an associative array, use brackets []
and assigning a value to a new key.
Try it yourself
array_push()
function appends one or more elements to the end of an array.
Try it yourself
You can use the +=
operator to add multiple key-value pairs to an associative array in PHP.
Try it yourself