Want to get rid of empty elements from an array. Use this function. Just pass the array to the function. It will return resultant array without empty elements.
Call function like this
$result = remove_empty($array);
print_r($result);
function remove_empty($array) {
foreach($array as $key => $value){
if(trim($value) == ''){
unset($array[$key]);
}
}
return $array;
}
Call function like this
$result = remove_empty($array);
print_r($result);
Posting Komentar