Code:
<?php
$name["T"]="Tahreem";
$name["R"]="Rizwan";
$name["F"]="Fatima";
$name["M"]="Misbah";
print_r(array_keys($name));
?>
Output:
Array ( [0] => T [1] => R [2] => F [3] => M )
Explanation:
In the above code we have declared $name array type variable and initialize it by index. First index name T has value Tahreem. Second index name R have value Rizwan. Third index name F have value Fatima. Fourth index name M have value Misbah. Then pass that array to array_keys function of php that returns all the keys of array. For example in the above code output 0=>T means ‘0’ index name is T and 1=>R means ‘1’ index name is R.