PHP pos() Function

PHP pos() Function

The pos() function in PHP returns the current element in an array which is initialized to the first element of the array. This function is an alias of current().

Syntax

pos ( array &$array )

Parameter

array(required)- This parameter represents the input array.

Return

This function returns the value of the array element that's currently being pointed to by the internal pointer.

Example 1

 

Output

The current pointer of the array is at mango

Example 2

 

Output

The pointer of the array is at pear

Example 3

 

Output

The pointer of the array is at 'bike'
The pointer of the array is at 'bike'
The pointer of the array is at 'car'
The pointer of the array is at 'car'
The pointer of the array is at 'car'