php - How to get key value of array? -
this question has reply here:
getting key of element in php array 5 answershow value of key of array item? how foreach loop turns $k => $v...except want once, no need loop. need create new array flips to?
take example.
1 => array( 'street' => 'street address ', 'town' => 'town/city ' ), 2 => array( 'state' => 'state ' ), those arrays within bigger array. , tried this
array_flip($thatarrayupthere[2]['state']) what want receive "state" because key name. i'm getting errors.
i'm not sure wan't, if want key of sec array in given array might help.
$key = key($array[2]); in illustration above "state" in $key variable.
php arrays key
No comments:
Post a Comment