My array looks like this:
Array (
[0] => Array (
[value] => Array (
[source] => vimeo
[url] => https://vimeo.com/000000
)
[type] => videos
)
[2] => Array (
[value] => 62
[type] => images
)
)
I want to unset the array id with the type => images.
I tried this:
$key = array_search('images',$slides);
unset($slides[$key]);
and it only deletes the first item in the array!!!
Update:
After all, I did it this way:
foreach ( $slides as $slide => $value) {
if ($display_mode == 'images' && $value['type'] == 'videos') {
unset($slides[$slide]);
} elseif ($display_mode == 'videos' && $value['type'] == 'images') {
unset($slides[$slide]);
}
}
Thank you.