Extending the original function...
<?
$stuff=array('dog', 'cat', 'car', 'house', 'donut');
$choice=choose($stuff, 30,50,70,90,100);
echo $stuff[$choice];
function choose($stuff, $prob1, $prob2, $prob3, $prob4, $prob5) {
$chance=rand(1,100);
if ($chance<=$prob1) { $a=0; }
elseif ($chance<=$prob2) { $a=1; }
elseif ($chance<=$prob3) { $a=2; }
elseif ($chance<=$prob4) { $a=3; }
else { $a=4;}
return $a;
}
?>
There are quite possibly other ways, also. But I'm having trouble 'thinking outside the box' lately....