Add Array in Laravel

Submitted by Xubayer - 1 year ago

The array_add function adds a given key / value pair to the array if the given key doesn't already exist in the array.

$array = ['foo' => 'bar'];

$array = array_add($array, 'key', 'value');
comments powered by Disqus