Home  >  Article  >  Backend Development  >  How to use end function

How to use end function

藏色散人
藏色散人Original
2019-02-12 10:20:185849browse

PHP end() function is used to point the internal pointer of the array to the last unit.

How to use end function

php end() function Syntax

Function: Point the internal pointer of the array to the last element and return the value of the element (if successful).

Syntax:

end(array)

Parameters:

array Required. Specifies the array to use.

Description: If successful, return the value of the last element in the array, if the array is empty, return FALSE.

php end() function example 1

<?php
$people = array("西门", "灭绝", "无忌");
echo end($people); //指向最后一个元素 无忌
?>

Output:

无忌

php end() function example 2

<?php
$people = array("peter", "无忌", "欧阳克");
echo end($people); //指向最后一个元素 欧阳克
?>

Output:

欧阳克

This article is an introduction to the PHP end function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use end function. 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
Previous article:How to use prev functionNext article:How to use prev function