©
This document usesPHP Chinese website manualRelease
voidappend
(mixed var)
voidappend
(string varname, mixed var)
voidappend
(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”时要考虑到数组的索 引,所以,如果添加和被添加的数组都是以数字为索引,他们会互相覆盖,或者产生不连续的索引。这并不象PHP中的array_merge()函数,后者会 删除原有的数字索引,重新对索引进行编号。
Example 13-1. append 例子 13-1. 添加
|