Difference between array_push() and $array[] =

前端 未结 9 2027
梦毁少年i
梦毁少年i 2020-12-02 07:06

In the PHP manual, (array_push) says..

If you use array_push() to add one element to the array it\'s better to use $array[]

9条回答
  •  时光取名叫无心
    2020-12-02 07:38

    You should always use $array[] if possible because as the box states there is no overhead for the function call. Thus it is a bit faster than the function call.

提交回复
热议问题