Home > Backend Development > PHP Tutorial > PHP deletes the last element and first element of an array_PHP tutorial

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:45:44
Original
750 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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template