javascript:
function array_keys( input, search_value, strict ) {
// Возвращает все или некоторое подмножество ключей массива
//
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
var tmp_arr = new Array(), strict = !!strict, include = true, cnt = 0;
for ( key in input ){
include = true;
if ( search_value != undefined ) {
if( strict && input[key] !== search_value ){
include = false;
} else if( input[key] != search_value ){
include = false;
}
}
if( include ) {
tmp_arr[cnt] = key;
cnt++;
}
}
return tmp_arr;
}
//Примеры:
alert ( array_keys( {firstname: 'Kevin', surname: 'van Zonneveld'}) );