php array filter out nulls code example
Example: remove empty array elements php
$colors = array("red","","blue",NULL);
$colorsNoEmptyOrNull = array_filter($colors, function($v){
return !is_null($v) && $v !== '';
});
//$colorsNoEmptyOrNull is now ["red","blue"]