The pos() function is the alias of current() function in PHP. It returns the current element of the array.
Syntax
pos(arr)
Parameters
arr − The specified array. Required.
Return
The pos() function returns the value of the current element in an array.
Example
The following is an example −
<?php
$arr = array("one", "two");
echo pos($arr);
?>Output
The following is the output −
one
Example
Let us see another example −
<?php
$a = array('one', 'two', 'three');
echo current($a)."\n";
echo next($a)."\n";
echo pos($a)."\n";
?>Output
The following is the output −
one two two