Home  >  Article  >  Backend Development  >  PHP array function sequence end() - moves the internal pointer of the array to the last element and returns the value of the element_PHP tutorial

PHP array function sequence end() - moves the internal pointer of the array to the last element and returns the value of the element_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:23:291042browse

Definition and Usage The
end() function sets the array internal pointer to the last element and returns the value of that element if successful.

Syntax
end(array) Parameter Description
array Required. Specifies the array to use.

Example

Copy code The code is as follows:

$people = array ("Peter", "Joe", "Glenn", "Cleveland");

echo current($people) . "
";
echo end($people);
?>

Output:

Peter
Cleveland

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324471.htmlTechArticleDefinition and usage The end() function points the internal pointer of the array to the last element and returns the value of the element (if success). Syntax end(array) Parameter Description array Required. It is stipulated to use...
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