Posted by noone on 02/23/06 20:19
monomaniac21 wrote:
> Hi all!
>
> Is there a function in PHP-MySQL to randomly select comma-seperated
> variables in a text field?
>
> For example if you have a text field containing the values
> "1,1.2,4,5.6," is there a way of randomly selecting one of the numbers?
>
> Any ideas would be greatly appreciated!
>
$selected = $arrayvar[ rand(0,array_count_values($record)-1) ]
get a random element within the array
not tested - YMMV.
[Back to original message]
|