Thursday, 25 September 2014

pos in PHP

PHP pos() function is used to get the value of a current element from an array.
Its alias to PHP current() function.

Syntax:

pos(array)
array : Required. Specifies the array to use.
Tip : PHP pos() function does not move the arrays internal pointer. To do this, use the next() and prev() functions.
Note : PHP pos() function returns FALSE on empty elements or elements with no value.

Example:

<?php
$daysarr = array( "Sunday","Monday","Tuesday","Wednesday","Thursday" );
echo pos($daysarr) . "<br />";
?>

O/P:

Sunday

0 comments:

Post a Comment