array_unshift

<!DOCTYPE html>
<html>
<body>

<?php
$a=array(0=>"red",1=>"green");
array_unshift($a,"blue");
print_r($a);
?>

</body>
</html>

运行结果

Array ( [0] => blue [1] => red [2] => green )

 

posted @ 2018-12-24 10:34  泥土里的绽放  阅读(126)  评论(0编辑  收藏  举报