how to get rid of an empty array in an array code example Example 1: remove null values from array php array_filter Example 2: how to remove NULL values in array PHP array_filter();