Reputation: 32721
I have two arrays as follows. And I want to pick up names from dir_info array which are not in templates['name']
In this case I want to pick up redrose.
Can anyone suggest how to do it?
Thanks in advance.
templates: Array
(
[0] => Array
(
[id] => 1
[name] => default
[default] => 1
)
[1] => Array
(
[id] => 2
[name] => bluenote
[default] => 0
)
[2] => Array
(
[id] => 3
[name] => redhat
[default] => 0
)
)
dir_info: Array
(
[default] => Array
(
[name] => default
...
)
[redhat] => Array
(
[name] => redhat
...
)
[redrose] => Array
(
[name] => redrose
...
)
)
Upvotes: 0
Views: 64
Reputation: 152294
$templates; $dir_info; // your arrays
$output = $dir_info;
foreach ( $templates as $template ) {
unset($output[$template['name']]);
}
$output; // filtered $dir_info array
Upvotes: 4