Answer the question
In order to leave comments, you need to log in
How to get array elements with specific value?
There is an array like:
Array
(
[45] => Array
(
[id] => 45
[title] => Женская
[parent_id] => 0
[link] =>
[sex] => 0
[visibility] => 1
)
[46] => Array
(
[id] => 46
[title] => Мужская
[parent_id] => 0
[link] =>
[sex] => 0
[visibility] => 1
)
[47] => Array
(
[id] => 47
[title] => Аксессуары
[parent_id] => 0
[link] =>
[sex] => 0
[visibility] => 1
)
и т.д
)
Answer the question
In order to leave comments, you need to log in
$array = array_filter($array, function($item) {
if ($item['parent_id'] === 0) {
return $item;
}
}
$filtered = array_filter($data, function($item) {
return $item['parent_id'] === 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question