- strpos: documentation ( source)
- var_export: documentation ( source)
- array_values: documentation ( source)
<?php
$array = ["abc", "def", "ghi"];
$excludeKeyword_arr = ["ab", "de"];
foreach ($array as $index => $haystack) {
foreach ($excludeKeyword_arr as $needle) {
if (strpos($haystack, $needle) !== false) {
unset($array[$index]);
break;
}
}
}
var_export(array_values($array));