My array print looks like this print_r($myArray);
Array
(
[http://link_to_the_file/stylename2.css] => Array
(
[mime] => text/css
[media] =>
[attribs] => Array
(
)
)
[http://link_to_the_file/stylename1.css] => Array
(
[mime] => text/css
[media] =>
[attribs] => Array
(
)
)
[http://link_to_the_file/stylename5.css] => Array
(
[mime] => text/css
[media] =>
[attribs] => Array
(
)
)
)
I need to find stylename 2 and 5 and unset them but I would like to find them only by their names and not the full array key. So I placed my search terms in array.
$findInArray = array('stylename2.css','stylename5.css');
foreach($myArray as $path => $file ){
// if $path contains a string from $findInArray
unset $myArray [$path];
}
What would be the best approach to this ? I tried array_key_exists but it matches only exact key value. Thank you!