current (): Finds the element at the pointer to the array.
pos (): Finds the element at the pointer to the array.
$LIST = ["alex","maria","rick","allen","bob"];
print "<pre>";
print_r($LIST);
print "</pre>";
$LIST_CURRENT = current($LIST);
print "<pre>";
print_r("current value: " . $LIST_CURRENT);
print "</pre>";
Array
(
[0] => alex
[1] => maria
[2] => rick
[3] => allen
[4] => bob
)
current value: alex
$LIST = ["alex","maria","rick","allen","bob"];
print "<pre>";
print_r($LIST);
print "</pre>";
$LIST_POS = pos($LIST);
print "<pre>";
print_r("pos value: " . $LIST_POS);
print "</pre>";
Array
(
[0] => alex
[1] => maria
[2] => rick
[3] => allen
[4] => bob
)
pos value: alex
$LIST = array(array("allen","bob"),"alex","maria","rick");
print "<pre>";
print_r($LIST);
print "</pre>";
$LIST_CURRENT = current($LIST);
print "<pre>";
print_r($LIST_CURRENT);
print "</pre>";
Array
(
[0] => Array
(
[0] => allen
[1] => bob
)
[1] => alex
[2] => maria
[3] => rick
)
Array
(
[0] => allen
[1] => bob
)
Leave a comment