⊗ppPmArECh 60 of 447 menu

Modifying Array Elements in PHP

Array elements can be modified similarly to modifying string characters:

<?php $arr = ['a', 'b', 'c']; $arr[0] = '!'; var_dump($arr); // outputs ['!', 'b', 'c'] ?>

Given the following array:

<?php $arr = ['a' => 1, 'b' => 2, 'c' => 3]; ?>

Change the value of each element of this array.

byenru