Home > Article > Backend Development > How to delete the last element in php
How to delete the last element in php: first create a new function "del_yuansu"; then create a new array; finally use the "array_pop" function to delete the last element of the array.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
Write the comments.
Create a new function del_yuansu.
Create a new array.
$shuzu=array("nihao","dfd","dfdf");
Use the array_pop function to delete the last element of the array.
Print the results.
print_r($del_node);
Call this function.
del_yuansu();
#Open the browser to test, and the result will be the deleted element.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to delete the last element in php. For more information, please follow other related articles on the PHP Chinese website!