How to delete the last element of an array?_PHP Tutorial
Jul 13, 2016 pm 05:12 PM
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:<br>';
for($i=0;$i<$count;$i++ ) echo $array[$i].'<br>';
array_pop($array);
$count = count($array);
echo 'new:<br>';
for($i=0;$i<$count;$i++) echo $array[$i].'<br>';
?>
Output result:
old :
PHP
JSP
ASP
new:
PHP
JSP

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to completely delete TikTok chat history

Complete collection of excel function formulas

PHP array key value flipping: Comparative performance analysis of different methods

The Art of PHP Array Deep Copy: Using Different Methods to Achieve a Perfect Copy

The first Snapdragon 8 Gen3 small foldable! Xiaomi MIX Flip joins the Internet: 67W fast charging, super large secondary screen

Application of PHP array grouping function in data sorting

Best Practices for Deep Copying PHP Arrays: Discover Efficient Methods

The role of PHP array grouping function in finding duplicate elements
