当前位置:网站首页>PHP end() function
PHP end() function
2022-06-24 05:11:00 【User 1448800】
example
Output the value of the current element and the last element in the array :
<?php
$people = array("Bill", "Steve", "Mark", "David");
echo current($people) . "<br>";
echo end($people);
?>Definition and Usage
end() Function points the pointer inside the array to the last element , And return the value of the element ( If it works ).
grammar
end(array)
Parameters | describe |
|---|---|
array | It's necessary . Specify the array to use . |
Technical details
Return value : | If successful, return the value of the last element in the array , Returns if the array is empty FALSE. |
|---|---|
PHP edition : | 4+ |
More instances
Example 1
Demonstrate all relevant methods :
<?php
$people = array("Bill", "Steve", "Mark", "David");
echo current($people) . "<br>"; // The current element is Bill
echo next($people) . "<br>"; // Bill The next element of this is Steve
echo current($people) . "<br>"; // Now the current element is Steve
echo prev($people) . "<br>"; // Steve The last element of is Bill
echo end($people) . "<br>"; // The last element is David
echo prev($people) . "<br>"; // David The previous element is Mark
echo current($people) . "<br>"; // The current element is Mark
echo reset($people) . "<br>"; // Move the internal pointer to the first element of the array , namely Bill
echo next($people) . "<br>"; // Bill The next element of this is Steve
print_r (each($people)); // Returns the key name and value of the current element ( At present, it is Steve), And move the internal pointer forward
?>边栏推荐
- How should a new data center be built?
- CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass
- Detailed explanation of the process after the browser enters the domain name and web address
- LeetCode 1290. Binary linked list to integer
- 问题:sql创建存储过程
- Confluence data center version is nearing its lifecycle
- GDB debugging container and command saving
- Svg quick start small white article
- 少儿编程教育在特定场景中的普及作用
- PHP uasort() function
猜你喜欢

Leetcode (question 2) - adding two numbers

Let children learn the application essence of steam Education

『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole

014_ TimePicker time selector

解析90后创客教育的主观积极性

Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture

Analyzing the superiority of humanoid robot in the post human era

What is the new generation cloud computing architecture cipu of Alibaba cloud?

解析后人类时代类人机器人的优越性
随机推荐
LeetCode 1290. Binary linked list to integer
Many regulations come into effect today! The main responsibility of network security will be further implemented
Elfk service setup
Introduction to vulnerability priority technology (VPT)
Performance comparison of JS loop traversal methods: for/while/for in/for/map/foreach/every
Where to buy domain name space? Can the domain name be repeated?
What is required for domain name filing and how to select an enterprise domain name
Fluent version control FVM
LeetCode 1791. Find the central node of the star chart
Analyzing the superiority of humanoid robot in the post human era
5g and industrial Internet
Eigen eigenMatrix
The trunk warehouse can also be tob, and Tencent cloud microenterprises do not leave quality behind
What is the implementation of domain name to IP address conversion? What are the benefits of switching to a website?
Pg-pool-ii read / write separation experience
Ext4 file system jam caused by MEM CGroup OOM
[jest] summary of the use of automated test jest
Understanding OAuth 2.0
Automatically convert local pictures to network pictures when writing articles
Verifying data models in golang