Tuesday, 27 August 2013

How can I check if a php array's keys all have values and none are blank or unset

How can I check if a php array's keys all have values and none are blank
or unset

I create a php array on the fly like below in php, which is then
json_encoded and sent back to the ajax script that requested it.
$myarr['key_a'] = 'a';
$myarr['key_b'] = 'b';
$myarr['key_c'] = 'c';
Before I do the json_encode, since the values for this come from a
database, is there someway I can check if all values are set and none are
blank or unset without having to check each key individually?

No comments:

Post a Comment