How to insert an item at the beginning of an array in PHP?

后端 未结 9 823
萌比男神i
萌比男神i 2020-12-02 14:53

I know how to insert it to the end by:

$arr[] = $item;

But how to insert it to the beginning?

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 15:24

    This will help

    http://www.w3schools.com/php/func_array_unshift.asp

    array_unshift();
    

提交回复
热议问题