Home >Backend Development >PHP Tutorial >PHP deletes the last element of the array array_pop() function usage_PHP tutorial
Deleting an element in an array is the most common. Today I will briefly introduce how to delete the last element. If you want to delete any element in the array, you can use my second method and add an if ( ){ unset()} can be achieved.
Example
The code is as follows
|
Copy code
|
||||
$stack = array("orange", "banana", "apple", "raspberry"); $fruit = array_pop($stack); print_r($stack);
[0] => orange Statement: 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 Previous article:PHP pagination can use tables to paginate classes_PHP tutorialNext article:PHP pagination can use tables to paginate classes_PHP tutorial Related articlesSee more |