So I have a PHP array like so:
Array
(
[0] => Array
(
[offset] => 1
[0] => 1
[name] => Value:990937970
[1] => Value:990937970
)
[1] => Array
(
[offset] => 2
[0] => 2
[name] => Value:482758260
[1] => Value:482758260
)
[2] => Array
(
[offset] => 3
[0] => 3
[name] => Value:2045053536
[1] => Value:2045053536
)
)
But I want to change it so that the numeric keys are not returned, like this:
Array
(
[0] => Array
(
[offset] => 1
[name] => Value:990937970
)
[1] => Array
(
[offset] => 2
[name] => Value:482758260
)
[2] => Array
(
[offset] => 3
[name] => Value:2045053536
)
)
My Question: Is there a simple way (without a foreach
or while
loop) to strip out these numeric keys?
I know that I can just do a foreach
where I check if $key is a string; however, loops add to my code's cyclomatic complexity so I am trying to avoid them.