php array_pop() function
Translation results:
英[pɒp] 美[pɑ:p]
vi. (Unexpectedly, suddenly) appear; appear suddenly; make a crackling sound; (suddenly) act
vt. (suddenly) reach out; (suddenly) ask a question; (suddenly take out something prepared); knock
n. pop music; soda; (especially used as a title) dad; (quickly) marked) mark
adj. Pop music; popular style
Third person singular: pops Plural: pops Present participle: popping Past tense: popped Past participle: popped
php array_pop() functionsyntax
Function:Delete the last element in the array
Syntax: array_pop(array)
Parameters:
Parameters | Description |
array | Required. Specifies an array. |
Description: Returns the last value of the array. If the array is empty, or not an array, NULL will be returned.
php array_pop() functionexample
<?php $a=array("西门","灭绝"); print_r(array_pop($a)); // 打印被删除的元素 echo "<br>"; print_r($a); //打印处理之后的数组 ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
灭绝 Array ( [0] => 西门 )
<?php $a=array("无忌","欧阳克","peter_zhu"); print_r(array_pop($a)); // 打印被删除的元素 echo "<br>"; print_r($a); //打印处理之后的数组 ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
peter_zhu Array ( [0] => 无忌 [1] => 欧阳克 )