Tag Archives: remove empty values from array

Remove empty values from array in PHP without looping

PHP provides an in-built function “array_filter” that removes all the key value pairs from the array that contain blank or null value. Syntax: array array_filter($arrayName) Example: The above code will print: Array( [0] => text [3] => -1 )