current

mixed current(array array) 

Returns the current element in the array without moving the internal array pointer.

Returns:

Value of the current element in the array; FALSE when no more elements exist

Description:

Returns the element value currently pointed to by the internal array pointer. This can be useful with next() and prev() in order to traverse an array; however, this is dangerous. The reason is that current() returns the value of the current element; if this evaluates to FALSE, there is no way to tell whether you’ve actually hit the end of the array being traversed or the current element simply has a value of FALSE.

This function does not move the internal array pointer.

Version:

PHP 3, PHP 4

See also:

 end() key() next() prev() ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.