Remove NULL or empty values from a PHP array

I found this simple code while searching. To remove emtpy ( “” ) values and NULL values: $new_array_without_nulls =($array_with_nulls); To remove only NULL values but ignore empty strings, etc: $new_array_without_nulls = array_filter($array_with_nulls, ‘strlen’); Credit goes to Brian Cray for the original post.