What's better to use in PHP, $array[] = $value or array_push($array, $value)?

前端 未结 10 1192
野性不改
野性不改 2020-12-02 01:28

What\'s better to use in PHP for appending an array member,

$array[] = $value;

or

array_push($array, $value);
10条回答
  •  孤街浪徒
    2020-12-02 02:03

    Word on the street is that [] is faster because no overhead for the function call. Plus, no one really likes PHP's array functions...

    "Is it...haystack, needle....or is it needle haystack...ah, f*** it...[] = "

提交回复
热议问题