I have this array:
Array
(
[702a4584] => Array
(
[type] => folder
[id] => 702a4584
)
[b547b3a9] => Array
(
[type] => folder
[id] => b547b3a9
)
[fcb0d055] => Array
(
[type] => page
[id] => fcb0d055
)
)
I want to filter the array so that only the "folder" type remains:
Array
(
[702a4584] => Array
(
[type] => folder
[id] => 702a4584
)
[b547b3a9] => Array
(
[type] => folder
[id] => b547b3a9
)
)
I could do this, but I will need a general function:
$temp = array();
foreach($array as $key => $value)
{
if($value['type'] =="folder")
{
$temp[$key] = $value;
}
}
source
share