This member function is implemented as follows:
<?php
class ArrayObject /* .... */ {
// ...
public function append($v) {
return $this->offsetSet(NULL, $v);
}
// ...
}
?>
(PHP 5 >= 5.0.0, PHP 7)
ArrayObject::append — 追加新的值作为最后一个元素。
value
将要被追加的值
没有返回值。
Example #1 ArrayObject::append() 例子
<?php
$arrayobj = new ArrayObject(array('first','second','third'));
$arrayobj->append('fourth');
$arrayobj->append(array('five', 'six'));
var_dump($arrayobj);
?>
以上例程会输出:
object(ArrayObject)#1 (5) { [0]=> string(5) "first" [1]=> string(6) "second" [2]=> string(5) "third" [3]=> string(6) "fourth" [4]=> array(2) { [0]=> string(4) "five" [1]=> string(3) "six" } }
This member function is implemented as follows:
<?php
class ArrayObject /* .... */ {
// ...
public function append($v) {
return $this->offsetSet(NULL, $v);
}
// ...
}
?>