php - Determining if an array of NULL values is considered empty -
i'm building array determine if need take action. executing query. table has sent_date field determine if email has been sent user or not. once has been sent user, sent_date field populated getdate(). here how i'm building:
$sent_date_sql = " select ind_id, sent_date profileemail "; $results = dbexec($sent_date_sql); i build array:
foreach ($results $r){ array_push($sent_date,$r['sent_date']); $query_count = count($results); } this working gloriously. issue when go check sent_date array. first time in month script runs, sent_date values null. array looks like:
array(228) { [0]=> null [1]=> null [2]=> null [3]=> null [4]=> null ...etc.
now going try evaluate $sent_date:
if(empty($sent_date)){ my empty condition never hits because values of array null. there alternative way achieve trying do? should looping through $sent_date array , evaluating each value?
if (!array_filter($sent_date)) array_filter removes "empty" elements array. if elements in array "empty", result array no elements (array()). empty array evaluates false.
Comments
Post a Comment