Home  >  Article  >  Backend Development  >  How to delete the last element in php

How to delete the last element in php

藏色散人
藏色散人Original
2021-05-17 10:04:142214browse

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.

How to delete the last element in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

Write the comments.

How to delete the last element in php

Create a new function del_yuansu.

How to delete the last element in php

Create a new array.

$shuzu=array("nihao","dfd","dfdf");

How to delete the last element in php

Use the array_pop function to delete the last element of the array.

How to delete the last element in php

Print the results.

print_r($del_node);

How to delete the last element in php

Call this function.

del_yuansu();

How to delete the last element in php

#Open the browser to test, and the result will be the deleted element.

How to delete the last element in php

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!

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