What are the potential pitfalls of using variables like $res['keys'] instead of numerical indexes like $res[1]?

Using associative keys like $res['keys'] instead of numerical indexes like $res[1] can lead to potential pitfalls such as confusion in the code, difficulty in debugging, and increased chances of errors when accessing array elements. To solve this issue, it is recommended to use numerical indexes for accessing elements in arrays to ensure clarity and consistency in the code.

// Example of using numerical indexes instead of associative keys
$res = array('value1', 'value2', 'value3');
echo $res[1]; // Output: value2