- 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
current() function in PHP
The current() function returns the current element in an array.
Syntax
current(arr)
Parameters
arr − The specified array. Required.
Return
The current() function returns the value of the current element in an array.
Example
The following is an example −
<?php $arr = array("one", "two"); echo current($arr); ?>
Output
The following is the output −
one
Example
Let us see another example −
<?php $a = array('one', 'two', 'three', 'four', 'five', 'six' ); echo current($a)."
"; echo next($a)."
"; echo current($a)."
"; ?>
Output
The following is the output −
one two two
Advertisements