This type of array is called an associative array. This helps you in a case where you need to define your own key as the index of the array. Let's say you want to print a users list where the User model/entity/table has the following column name:
Rather than printing the array as $user[0]
you can call it $user['name']
It's not only typed-friendly but also helps you to avoid collapse.
There might be cases where email is retrieved before the name column. You are expecting something like this:
0 => 'John Doe',
1 => 'john@example.com',
2 => '0999999999'
But end up with something like this:
0 => 'John Doe',
1 => '0999999999',
2 => 'john@example.com'
To avoid those cases you can print/access them by their key defined by you. In such cases, you don't have to follow the serial. Just print them according to their key name.
// no need to remember the index
"name" => 'John Doe',
"phone" => '0999999999',
"email" => 'john@example.com'
For more you can give it a read: https://www.php.net/manual/en/language.types.array.php