I\'ve got an associative array in PHP and want to select a random key/value pair out of it. Here\'s what I have so far:
Initialize.
$locations = arra
array_rand() returns a key from the array, not a value. You can just use:
$location_name = $locations[$rand];
To get the location name.
Here's a full example: http://codepad.org/zR2YdMGN
Just click submit a few times, you'll see the random working.