I need to check if the value exists in the array and once it exists I need to get the object.
Array
(
[0] => Array
(
[_id] => Array
(
[purok] => test
[year] => 2017
[options] => below-1
)
[data] => Array
(
[58cf4935572d6e32900057ab] => Array
(
[age-sex-distribution] => Array
(
[age-range] => Array
(
[options] => below-1
)
[gender] => Array
(
[male-distribution-count] => 12
[female-distribution-count] => 12
)
)
)
)
[date] => 2017-07-08
)
[1] => Array
(
[_id] => Array
(
[purok] => test
[year] => 2017
[options] => toddlers (1-2)
)
[data] => Array
(
[58cf4935572d6e32900057ab12] => Array
(
[age-sex-distribution] => Array
(
[age-range] => Array
(
[options] => toddlers (1-2)
)
[gender] => Array
(
[male-distribution-count] => 12
[female-distribution-count] => 12
)
)
)
)
[date] => 2017-07-08
)
)
I need to check this [options] => below-1 if it exists. One it exist, I need to get the data in the array.
So far, I have tried this one.
$keySearch = "data.options";
$dataOption = array_search("below-1", array_column($rec, $keySearch));
print_r($dataOption);
But got no result.
Thanks for helping me in advance.