how would you convert this array:
Array
(
[0] => Array
(
[Contact] => Array
(
[number] => 0425 234 634
)
)
[1] => Array
(
[Contact] => Array
(
[number] => 2939 492 235
)
)
)
into this array
Array
(
[0] => 0425 234 634
[1] => 2939 492 235
)
?
See Set::extract() It uses xpath notation to extract node values from paths in arrays.
$numbers = Set::extract('/Contact/number', $numbers);
Achieve all this in 1 line in far more understandable code than other examples suggested here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With