PHP pos() Function

The pos() function returns the value of the current element in an array.

Every array has an internal pointer to its “current” element, which is initialized to the first element inserted into the array.

Tip: This function does not move the arrays internal pointer.

Parameter Description
array Required. Specifies the array to use

Syntax

pos(array)

Example

$people = array("Cooper","Samuel","James");
echo pos($people);

Output

Cooper

Leave a Reply

Your email address will not be published. Required fields are marked *