Delete a cell element at the beginning
Array_shift
(PHP 4, PHP 5)
Array_shift - moves the cell at the beginning of the array to the group
Description
Array_shift   (   array   & $array   )
arra Y_shift ()   will   array   is moved out and returned as a result, array   the length minus all the other units moving forward one bit. All numeric key names are changed from zero to start, and the text key name is unchanged.
Note: Using this function resets the (reset())array pointer.
Parameters
return value
Returns the value that is moved out if array it NULL is empty or not an array.
Example
Example #1 array_shift () Example
<?php
$stack= Array ("Orange", "Banana", "Apple", "Raspberry");
$fruit= Array_shift($stack);
Print_r($stack);
?>
The above routines will output:
Array ([0] = banana [1] = Apple [2] = raspberry)
and Orange was assigned to it $fruit .
Delete Trailing cell elements
Array_pop
(PHP 4, PHP 5)
Array_pop - pops the last element of the array (out of the stack)
Description
Mixed array_pop ( array ) &$array
Array_pop () Eject and return array The last cell of the array, and the array array Of the length minus one. If array Empty (or not an array) will return NULL。 Also, if the call is not a number, it will produce a Warning.
Note: Using this function resets the (reset())array pointer.
Parameters
return value
array returns the last value. If array NULL It is empty (if it is not an array), it will be returned.
Example
Example #1 array_pop () Example
<?php
$stack= Array ("Orange", "Banana", "Apple", "Raspberry");
$fruit= Array_pop($stack);
Print_r($stack);
?>
After this operation, $stack There will be only 3 units:
Array ([0] = orange [1] = banana [2] = apple)
and rasberry will be assigned to $fruit .
This article from "I am a phper, simple and naïve" blog, please be sure to keep this source http://thinkforphp.blog.51cto.com/8733331/1784640
PHP-delete array kinsoku elements