Javatpoint Logo
Javatpoint Logo

PHP pos() function

The PHP pos( ) function is used to fetch the value of the current element in an array. The PHP pos( ) function is an alias of current( ) function. This function was introduced in PHP 4.0.

Syntax

Parameter

Parameter Description Is compulsory
array Specifies the array to use. compulsory

Returns

The pos( ) function returns the value of the current element in an array or false on empty elements.

Example 1

Output:

aajtak

Example 2

Output:

aajtak
zeenews

Example 3

Output:

archery
badminton
badminton

Example 4

Output:

archery
badminton
badminton
archery
badminton





Help Others, Please Share

facebook twitter pinterest