Skip to content

How to add an array into an associative array in PHP?

// for php 5.4+
$data += [$key => $value];

// for php 5.4-
$data += array($key => $value);
See also  Python code snippet - How to change entry in a row based on another columns entry ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.