?
本文檔使用 PHP中文網手冊 發(fā)布
void append
(mixed
var)
void append
(string
varname, mixed var)
void append
(string
varname, mixed var, boolean merge)
This is used to append an element to an assigned array. If you
append to a string value, it is converted to an array value and then
appended to. You can explicitly pass name/value pairs, or associative
arrays containing the name/value pairs. If you pass the optional third
parameter of true, the value will be merged with the current array
instead of appended.
添加指定的元素到數組中。如果是添加一個字符串,該字符串會被轉換為數組格式后再進行添加。所添加的數據可以采用 名稱, 數值
的格式,或者是使用 “=>”連接的聯合數組格式。如果第三個可選參數被指定為
TRUE,所添加的數據會和數組中現有數據進行合并,而不是直接添加。
Technical Note: The merge parameter respects array keys, so if you merge two numerically indexed arrays, they may overwrite each other or result in non-sequential keys. This is unlike the array_merge() function of PHP which wipes out numerical keys and renumbers them.
注意:使用第三個參數“merge”時要考慮到數組的索 引,所以,如果添加和被添加的數組都是以數字為索引,他們會互相覆蓋,或者產生不連續(xù)的索引。這并不象PHP中的array_merge()函數,后者會 刪除原有的數字索引,重新對索引進行編號。
Example 13-1. append 例子 13-1. 添加
|