使用php的array_push()函数可以向数组的末尾添加一个或多个元素。该函数的语法如下:
array_push($array, $element1, $element2, ...)
其中,$array是要添加元素的数组,$element1, $element2等是要添加到数组末尾的元素。例如:
$fruits = array("apple", "banana");
array_push($fruits, "orange", "mango");
执行上述代码后,$fruits数组将包含[“apple”, “banana”, “orange”, “mango”]。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>