Random array values from associative

From: Date: Tue, 18 Mar 2003 11:40:03 +0000
Subject: Random array values from associative
Groups: php.general 
Request: Send a blank email to php-general+get-140109@lists.php.net to get a copy of this message
I have an associative like array["name"]="hello"; I am trying to get two random values from the array, the key name and the value, but using the codes below from the PHP manual i am getting the inex key value rather than the name. $rand_keys = array_rand ($input, 2); print $input[$rand_keys[0]]."\n"; print $input[$rand_keys[1]]."\n"; so instead of getting two random values like key=name & value="hello" i am getting key=0 and value=hello. How do i get the name of the key not the index number? Thanks in advance -awlad

« previous php.general (#140109) next »