I have an array that looks like this:
$daysArray = array(2=>array('#linkhere','linked-day'));
I need to push another array into here but define the key.
I have tried:
$value= $key.'=>array("#$event","linked-day")';
//$value= 2=>array('/weblog/archive/2004/Jan/02','linked-day')
array_push($daysArray, 开发者_如何学JAVA$value);
If you want to append another array onto your primary array you can use:
$daysArray[$key] = array($event, "linked-day");
Doc: http://us.php.net/array_push
From the Docs:
Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.
you to try:
$result = array_merge($array1, $array2);
精彩评论