tengo una matriz como la siguiente:PHP - Obtener el nombre clave del valor de matriz
function example() {
/* some stuff here that pushes items with
dynamically created key strings into an array */
return array(// now lets pretend it returns the created array
'firstStringName' => $whatEver,
'secondStringName' => $somethingElse
);
}
$arr = example();
// now I know that $arr contains $arr['firstStringName'];
necesito para averiguar el índice de $arr['firstStringName']
por lo que yo soy capaz de recorrer array_keys($arr)
y devolver la cadena de clave 'firstStringName'
por su índice. ¿Cómo puedo hacer eso?
puedes contar con un uso caso de lo que estás tratando de lograr? –