PHP current() function

PHP current() function

The current() function in PHP returns the current element in an array, which is initialized to the first element inserted into the array.

Syntax

Parameter

array (required)– This parameter represents the input array or countable object.

Return

This function returns the value of the array element that’s currently being pointed to by the internal pointer. It returns false if the internal pointer points beyond the end of the elements list or the array is empty.

Example 1

Output

Example 2

Output

Example 3

Output