Rand Array is not assign the chosen value
Posted: Wed Oct 10, 2007 6:48 pm
feyd | Please use
The result should be $PercentageAddOn[] = 1.32; but when echo'd it doesnt show anything....Any one know why?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a random array and when i echo the value that the array choose it seems to be empty..... I'm not sure why.. i purposely only put one choice for testing purposes and it still won't do it.... this is what i have:Code: Select all
$PercentageAddOn = array();
//$PercentageAddOn[] = 2.62;
//$PercentageAddOn[] = 52421;
//$PercentageAddOn[] = 51;
$PercentageAddOn[] = 1.32;
//$PercentageAddOn[] = 4.72;
//$PercentageAddOn[] = 9.72;
//$PercentageAddOn[] = 0.2;
//$PercentageAddOn[] = 0.72;
//$PercentageAddOn[] = 0..9;
$PercentageKey = array_rand($PercentageAddOn);
$PercentageAddOn = $PercentageResults[$PercentageKey];feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]