PHP deletes the last element and first element of an array_PHP tutorial

WBOY
Release: 2016-07-13 17:45:44
Original
693 people have browsed it

Just use the array_pop function in php4, function prototype:
mixed array_pop(array array)
For example:
$array = array(php,jsp,asp);
$count = count($array);
echo old:
;
for($i=0;$i<$count;$i++) echo $array[$i].
;
array_pop($array);
$count = count($array);
echo new:
;
for($i=0;$i<$count;$i++) echo $array[$i].
;
?>
Output result:
old:
php
jsp
asp
new:
php
jsp

php delete the first element of array

$new_data = array_splice($insert_data, 1); //Delete the first value of the array

Author "Rock 21's Blog"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478649.htmlTechArticleUse the array_pop function in php4. Function prototype: mixed array_pop(array array) For example: ? $array = array(php,jsp,asp); $count = count($array); echo old:br; for($i=0;$i...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!