I have multiple arrays (which are all results from a MySQL database using a PDO statement), here is one as an example:
Array ( [id] => 1 [0] => 1 [name] => HELLO [1] => HELLO )
I only want the keys which are not numbers (in this case ‘id’ and ‘name’) as the array.
How can I filter out the keys which are integers so that I can end up with an array which will be:
Array ( [id] => 1 [name] => HELLO )
(The keys aren’t always going to be ‘id’ and ‘name’, or the name numbers, or the same number of array keys)
I think you should solve this problem fetching row with appropriate flag PDO::FETCH_ASSOC
If it’s not possible: