//prints 13
print(max("hello", "55", 13). "
\n");
//prints 17
print(max(1, 17, 3, 5.5). "
\n");
?>
value min(array arrayname) value min(...)
The min function returns the smallest value from all the array elements. If all values are
strings, then the values will be compared as strings. If any of the values is a number, only
the integers and doubles will be compared numerically. The alternate version of the min
function takes any number of arguments and returns the smallest of them. You must
supply at least two values.
<?
$colors = array("red"=>"FF0000",
"green"=>"00FF00",
"blue"=>"0000FF");
//prints 0000FF
print(min($colors). "
\n");
//prints 13
print(min("hello", "55", 13). "
\n");
//prints 1
print(min(1, 17, 3, 5.5). "
\n");
?>
value next(array arrayname)
The next function moves PHP's array pointer forward one element. It returns the value at
the new element. If the pointer is already at the end of the array, FALSE is returned.
<?
$colors = array("red", "green", "blue");
$my_color = current($colors);
do
{
print("$my_color
\n");
}
while($my_color = next($colors))
?>