Definition
The pos() function returns the value of the current element in an array(alias of current()
function).
Syntax
pos(array)
Parameters
Parameter | Description |
---|---|
array |
Required. Specifies the array to use. |
Example
<?php
// Example 1
$cities = array("New York", "London", "Tokyo", "Berlin", "Cairo");
echo pos($cities) . "<br>";
// Examples in conjunction with other related functions
echo pos($cities) . "<br>";
echo next($cities) . "<br>";
echo pos($cities) . "<br>";
echo end($cities) . "<br>";
echo pos($cities) . "<br>";
echo prev($cities) . "<br>";
echo pos($cities) . "<br>";
echo reset($cities) . "<br>";
echo pos($cities) . "<br>";