Array - get the key from the value

From: Date: Thu, 05 Dec 2002 14:54:45 +0000
Subject: Array - get the key from the value
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6650@lists.php.net to get a copy of this message
Hi, I've searched the mailing-list archive without finding info on this. Here is my problem: I have an associative array that looks like this: $MyTypes = array( 'ids' => $ids, 'types' => $types ); ids types ----------------------------- 0 switched 1 terminated And I want to make a dropdown menu with this: {html_options values=$MyTypes.ids output=$MyTypes.types selected=???} The problem is that I want a certain option to be selected. How can I get the key from the value? Here, knowing "terminated", I want to get the "1"... which is the value of "terminated"... Thanks, Philippe.

« previous php.smarty.general (#6650) next »