Arrays: array_shift($arr) or $arr[0]?

前端 未结 11 718
说谎
说谎 2021-01-14 04:08

Which one would you use?

Basically I only want to get the 1st element from a array, that\'s it.

11条回答
  •  灰色年华
    2021-01-14 04:22

    given what you need, $arr[0] is preferrable, because it's faster. array_shift is used in other situations.

提交回复
热议问题