- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
next() function in PHP
The next() function advance the internal array pointer of an array to the next element.
Syntax
next(arr)
Parameters
arr − The specified array
Return
The next() function returns the value of the next element in the array, on success. It returns FALSE, if no more elements are available.
Example
The following is an example −
<?php $os = array('windows', 'mac', 'linux', 'solaris'); echo current($os) . "<br>"; echo next($os); ?>
Output
windows mac
Example
Let us see another example −
<?php $a = array('one', 'two', 'three', 'four', 'five', 'six' ); echo current($a)."
"; echo next($a)."
"; echo current($a)."
"; echo next($a)."
"; echo end($a)."
"; echo current($a)."
"; ?>
Output
one two two three six six
Advertisements