PHP – add item to beginning of associative array [duplicate]

You could use the union operator:

$arr1 = array('key0' => 'value0') + $arr1;

or array_merge.

Leave a Comment