Question: I want to print the array index for some purpose. Can anybody tell me about this ?

Answer: 
Get the first index of an elemnt:

```
$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
$key = array_search('green', $array); // $key = 2;
echo $key;

```

For all elemnts

```
foreach($array as $key => $value){
    echo "{$key} => {$value}\n";
}

```

will output

```
0 => blue
1 => red
2 => green
3 => red

```

All keys:

```
echo implode(', ',array_keys($array));

```

will output

```
 0, 1, 2, 3

```
if you mean the keys of the array:

```
$array = array(0 => 100, "color" => "red");
print_r(array_keys($array));

//result
Array
(
    [0] => 0
    [1] => color
)

```

This will provide an array of the keys