Another one liner to remove empty ("" empty string) elements from your array.
$array = array_filter($array, function($a) {return $a !== "";});
Note: This code deliberately keeps null, 0 and false elements.
Or maybe you want to trim your array elements first:
$array = array_filter($array, function($a) {
return trim($a) !== "";
});
Note: This code also removes null and false elements.