php-arrays function-array_shift-A unit at the beginning of an array _php tutorial

Source: Internet
Author: User
Array_shift () move a cell at the beginning of the divisor group

function
The function will pop up and return the first cell of the array, and then subtract the length of the array by one
All numeric key names are changed to zero-based counting
Returns null if array is empty or not an array
"Scope of Use"
PhP4, PHP5.
Use
Mixed Array_shift (array &array)
array/Required/impending function processing array
Example
[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"
}
*/


Excerpts from Zuodefeng's notes

http://www.bkjia.com/PHPjc/478191.html www.bkjia.com true http://www.bkjia.com/PHPjc/478191.html techarticle Array_shift () removes a cell from the beginning of the array "function" the function pops up and returns the beginning of the array to a cell, and then the length of the arrays minus one of the number keys will be changed from ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.