php end function and current function

WBOY
Release: 2016-07-29 09:14:42
Original
1245 people have browsed it

end() function: The

end() function points the pointer inside the array to the last element, and returns the value of the element if successful;

for example:

<code><span>$people</span> = <span>array</span>(<span>"Peter"</span>, <span>"Joe"</span>, <span>"Glenn"</span>, <span>"Cleveland"</span>);
<span>echo</span> end(<span>$people</span>);</code>
Copy after login

output: Cleveland

current () function:

current() function returns the current element (unit) in the array.
Each array has an internal pointer that points to its "current" element, initially pointing to the first element inserted into the array.

**Note: If there is an empty element, or the element has no value, this function also returns FALSE.
Tip: This function does not move the internal pointer. To do this, use the next() and prev() functions. **

For example:

<code><span>$people</span> = <span>array</span>(<span>"Peter"</span>, <span>"Joe"</span>, <span>"Glenn"</span>, <span>"Cleveland"</span>);
<span>echo</span> current(<span>$people</span>);</code>
Copy after login

output: Peter

The above introduces the PHP end function and current function, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!