I have a multidimensional array (fake data) in PHP:
Array
(
[0] => Array
(
[pmkSuppliers] => 1
[0] => 1
[Name] => Supplier2
[1] => Supplier2
[Email] => [email protected]
[2] => [email protected]
[Address] => 624 st
[3] => 624 st
[Phone] => 900-111-1111
[4] => 900-111-1111
[Fax] => 900-111-1112
[5] => 900-111-1112
[TechSupport] => 900-111-1112
[6] => 900-111-1112
[Contact] => Greg
[7] => Greg
[Modified] => 2016-06-07
[8] => 2016-06-07
)
[1] => Array
(
[pmkSuppliers] => 2
[0] => 2
[Name] => Nike
[1] => Nike
[Email] => [email protected]
[2] => [email protected]
[Address] => 4566 way
[3] => 4566 way
[Phone] => 901-206-5555
[4] => 901-206-5555
[Fax] => 901-206-5555
[5] => 901-206-5555
[TechSupport] => 901-206-5445
[6] => 901-206-5445
[Contact] => Brad
[7] => Brad
[Modified] => 2016-06-08
[8] => 2016-06-08
)
)
I want to remove all of the elements with a non int key. So it would look something like this:
Array
(
[0] => Array
(
[0] => 1
[1] => Supplier2
[2] => [email protected]
[3] => 624 st
[4] => 900-111-1111
[5] => 900-111-1112
[6] => 900-111-1112
[7] => Greg
[8] => 2016-06-07
)
[1] => Array
(
[0] => 2
[1] => Nike
[2] => [email protected]
[3] => 4566 way
[4] => 901-206-5555
[5] => 901-206-5555
[6] => 901-206-5555
[7] => Brad
[8] => 2016-06-08
)
)
I figure there has to be an easy way to do this, but I'm stuck. I can not use the PHP method array_unique because sometimes the values in my array are the same (like in the second set).
If anyone could point me in the right direction, that would be awesome.
Thanks,
FP
EDIT
This is how I have been doing it, but it seems crude.
foreach ($array as $insideArray) {
foreach ($insideArray as $key => $value) {
if (!is_int($key)) {
echo $value;
}
}
}
PDO::FETCH_NUM. Can I see your fetching code?