数组:array_shift($ arr)或$ arr [0]? [英] Arrays: array_shift($arr) or $arr[0]?

查看:56
本文介绍了数组:array_shift($ arr)或$ arr [0]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您会使用哪个?

基本上我只想从数组中获取第一个元素,就是这样.

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

推荐答案

array_shift 实际上会从数组中删除指定的值.除非您真的想减少数组,否则不要使用它!

array_shift will actually remove the specified value from the array. Do not use it unless you really want to reduce the array!

请参阅此处: http://php.net/manual/zh/function.array-shift.php

这篇关于数组:array_shift($ arr)或$ arr [0]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆