摘要:
下文讲述php中array_push函数的功能讲解,如下所示;
array_push函数功能说明:
向数组的尾部添加元素
array_push语法:
array_push(array,value1,value2...)
--------参数说明------
array:必填参数,待添加数值的原数组
value1:必填参数,待添加的值
value2:可选参数,待添加的值
--------返回值说明-----
返回新数组的元素个数
---------注意事项-----
1.添加新元素后,这些新数组元素的键名始终是数字键
2.当函数中第一个参数为非数组时,则会产生相应的警告信息
例:
php数组之array_push函数示例分享
echo "maomao365.com php array_product函数的示例分享\n";
$a=array("tt"=>"maomao365","linux28"=>"linux28.com");
echo array_push($a,"test","otherInformation");
echo "\n";
print_r($a);
?>
//输出
maomao365.com php array_product函数的示例分享
4
Array
(
[tt] => maomao365
[linux28] => linux28.com
[0] => test
[1] => otherInformation
)