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  CSS code snippet - How to check if eloquent result is empty?

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.