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  PHP code snippet - How to loop array in laravel?

Leave a Reply

Your email address will not be published.

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