PhiSYS wrote:

How to get the key of a specific index of array?

Sorry, but an index is they key.


$foo = array(0 => "Apples", 1 => "Oranges", 2 => "Grapes");
$key = 2;
$value = $foo[$key];
echo $value; //you would get Grapes

//another way (maybe this is what you are after)

while(list($key,$value) = each($foo))
{
  echo "For key ".$key." the value is ".$value;
}

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to