How to rewrite array values in PHP arrays

Sep 10, 2020 PHP beginners beginners PHP7


Implementation environment

――I wrote this article while checking the operation of PHP on the following site. -


Specific example of rewriting the data of the existing index of the associative array

Specific example of adding a new index to an associative array


foreach ($ items as & $ item) {
    $ item ['id'] = 123;