Home > php教程 > php手册 > body text

php-Arrays函数-array_shift-移除数组开头的一个单元

WBOY
Release: 2016-06-13 10:49:52
Original
1298 people have browsed it

array_shift() 移除数组开头的一个单元

【功能】
         该函数将弹出并返回array数组的开头一个单元,然后将数组的长度减一
         所有数字键名将改为从零开始计数
         如果array为空或不是数组将返回null
【使用范围】
         php4、php5.
【使用】
         mixed array_shift( array &array )
         array/必需/即将进行函数处理数组
【示例】
[php]
$array = array('orange','banana','apple'); 
var_dump($array); 
var_dump(array_shift($array)); 
var_dump($array); 
/*
array(3) {
  [0]=>
  string(6) "orange"
  [1]=>
  string(6) "banana"
  [2]=>
  string(5) "apple"
}
string(6) "orange"
array(2) {
  [0]=>
  string(6) "banana"
  [1]=>
  string(5) "apple"
}
*/ 

 


摘自 zuodefeng的笔记

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template