Home  >  Article  >  Backend Development  >  PHP array function sequence array_pop() deletes the last element in the array

PHP array function sequence array_pop() deletes the last element in the array

不言
不言Original
2018-04-17 16:29:031650browse

This article introduces the PHP array function sequence array_pop() to delete the last element in the array. It has a certain reference value. Now I share it with you. Friends in need can refer to it

Definition and usage The array_pop() function deletes the last element in the array.

array_pop() definition and usage
array_pop() function deletes the last element in the array.

Syntax
array_pop(array) Parameter Description
array Required. Specifies the input array parameters.

Example

Copy code The code is as follows:

<?php 
$a=array("Dog","Cat","Horse"); 
array_pop($a); 
print_r($a); 
?>

Output:

Array ( [0] => Dog [1] => Cat )

Related recommendations:

php array function

How to convert php array into json format introduce

The above is the detailed content of PHP array function sequence array_pop() deletes the last element in the array. 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