i have created an array using compact
$rank_month = compact('jan','feb','mar');
like this and the data will be fetch using queries and due to that the data will sometimes will be empty
and the data will be numbers. And then I'm using the max(array_filter) and min(array_filter)
to get the highest and lowest in the array but when the query is empty i get the ERROR: max(): Array must contain at least one element
& ERROR Min(): Array must contain at least one element
is it possible to condition it like
if(empty(max(array_filter('$rank_month')))){
$high = ""; }
else{
$high = max(array_filter('$rank_month'
}
or is their any way to fix this error? even if the data is empty
thanks.
Aucun commentaire:
Enregistrer un commentaire