I have an array, $search_results
. Each key has multiple elements. I also have a single column array called $outofstock
. If any of the elements within a particular key of $search_results
exactly match any of the entries in $outofstock
, I would like to remove the key, and re-arrange the key structure, so as to not have a gap in key ordering - and then create a new array of the same name: $search_results
.
I've tried a few solutions found here - namely
- Search an Array and remove entry if it doesn't contain A-Z or a A-Z with a dash, and
- PHP - get all keys from a array that start with a certain string
But I can't seem to get them to match the text exactly and then re-create the array, while using array_filter
to remove the entries I need to remove.