You want array_diff
.
array_diff
returns an array containing
all the entries fromarray1
that are
not present in any of the other
arrays.
So you want something like:
$good = array_diff($arr, $disallowed_words);
More Related Contents:
- Array Comparision with a string PHP
- “Notice: Undefined variable”, “Notice: Undefined index”, “Warning: Undefined array key”, and “Notice: Undefined offset” using PHP
- Parse query string into an array
- How to group subarrays by a column value?
- Performance of FOR vs FOREACH in PHP
- Sorting an associative array in PHP [duplicate]
- Convert backslash-delimited string into an associative array
- php stdClass to array
- Preserve key order (stable sort) when sorting with PHP’s uasort
- Fatal error: Cannot use object of type mysqli_result [closed]
- PHP: Sort an array by the length of its values?
- Return index of highest value in an array
- Group array by subarray values
- Remove all elements from array that do not start with a certain string
- How do I count occurrence of duplicate items in array [duplicate]
- Recursively remove empty elements and subarrays from a multi-dimensional array
- How to convert an array into an object using stdClass() [duplicate]
- PHP remove duplicate values from multidimensional array
- scandir() to sort by date modified
- Print the keys of an array
- Parse error: Invalid numeric literal
- Notice: Undefined index when trying to increment an associative array in PHP
- PHP – Get key name of array value
- Group 2d array data using column value to create a 3d array
- Why does this PHP code just echo “Array”?
- How can I sum all values of a specific array key recursively?
- Reorganize array in twig
- Get count of each unique value in one column of a 2d array
- Does array_unique() modify its array by reference?
- How to send the values of an array of checkboxes through Ajax using jQuery?