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

current ( array $array )  

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

The current pointer of the array is at mango

Example 2

 

Output

The current pointer of the array is at pear

Example 3

 

Output

The current pointer of the array is at