0
function array_push_multi_assoc($array, $key, $key2, $value){
$array[$key][$key2] = $value;
return $array;
}
$myarray = array_push_multi_assoc($myarray, $key=0, 'subject', 'hello');
print_r($myarray);
Array
(
[0] => Array
(
[id] => 97
[email] => [email protected]
[subject] => hello
)
[1] => Array
(
[id] => 93
[email] => [email protected]
)
[2] => Array
(
[id] => 94
[email] => [email protected]
)
)
我想有這樣的事情:推項目的每一個關聯數組在PHP
Array
(
[0] => Array
(
[id] => 97
[email] => [email protected]
[subject] => hello
)
[1] => Array
(
[id] => 93
[email] => [email protected]
[subject] => hello
)
[2] => Array
(
[id] => 94
[email] => [email protected]
[subject] => hello
)
)
這可以通過簡單的foreach循環和添加索引值來實現。 – 2014-10-27 10:12:31