PHP Update Array Items

Update Array Item

To update an existing array item, you can refer to the index number for indexed arrays, and the key name for associative arrays.

Example

Change the second array item from “BMW” to “Ford”:

$cars = array("Volvo", "BMW", "Toyota");
$cars[1] = "Ford";

Note: The first item has index 0.

Continue reading PHP Update Array Items