getting top and bottom numbers
Posted: Thu Oct 23, 2003 8:30 am
Is there a function in that will grab the top number out of and array and the bottom number?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$arr = array(
9=>'i',
5=>'e',
25=>'y',
12=>'l'
);
$keys = array_keys($arr);
sort($keys);
echo $keys[0], '...', $keys[count($keys)-1];
?>Code: Select all
$foo = array(7,4,9,2,4,3,1);
echo min($foo);
echo max($foo);