PHP associative and indexed arrays are different.
Associative arrays uses named keys --- strings, to access the variable data. Your code generates an associative array, so using
var_dump($new_array[1]) // wont work
var_dump($new_array['ca']) // will work
Indexed arrays uses numeric values, just like a regular array would
Accessing your new array, we could:
foreach ($new_array as $key => $value) {
var_dump($new_array[$key]);
}
I do not know if it would be useful but we can force an index array implementation using $array[] = ..
$new_new_array = [];
foreach ($new_array as $data) {
$new_new_array[] = $data;
}
var_dump($new_new_array[1]); // this works
I can only manage to do this at the very end because your data processing requires the keys to be strings.