- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
- Related Articles
- How to get current function name in PHP?
- PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function
- file_exists() function in PHP
- basename( ) function in PHP
- chgrp()function in PHP
- chmod() function in PHP
- chown() function in PHP
- clearstatcache() function in PHP
- copy() function in PHP
- delete() function in PHP
- dirname()function in PHP
- disk_free_space() function in PHP
- disk_total_space() function in PHP
- diskfreespace() function in PHP
- fclose() function in PHP

Advertisements