How to rewrite array values in PHP arrays

Sep 10, 2020 PHP beginners beginners PHP7

Purpose

Implementation environment

――I wrote this article while checking the operation of PHP on the following site. -https://paiza.io/ja

#Example

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

#References


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