You have to set the keys yourself , If not it adds automatically an index starting from 0.
Example
function myfunc(){
$arr = array();
$arr[] = 'value0';
$arr['key1'] = 'value1';
$arr['key2'] = 'value2';
$arr[] = 'value3';
return $arr;
}
Output
// you see the first and fourth value has the index 0 and 1,
// the other those that are defined
array(4) {
[0]=>
string(6) "value0"
["key1"]=>
string(6) "value1"
["key2"]=>
string(6) "value2"
[1]=>
string(6) "value3"
}
I hope this helps you.