Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php add element to beginning of associative array

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

-------------- OR ------------------

<?php
$arr = array('key1' => 'value1', 'key2' => 'value2');
$arr = array_merge(array('key0' => 'value0'), $arr);
 
PREVIOUS NEXT
Tagged: #php #add #element #beginning #associative #array
ADD COMMENT
Topic
Name
6+6 =