Here is what I have, I know I can rewrite my conditional syntax but I just wanted to see if there was something else I can do with what I have.
$sleeping[] = ($a->day_bed == 1) ? 'Day Bed' : false; $sleeping[] = ($a->fold_up_bed == 1) ? 'Fold Up Bed' : false; $sleeping[] = ($a->murphy_bed == 1) ? 'Murphy Bed' : false; $sleeping[] = ($a->trundle_bed == 1) ? 'Trundle Bed' : false; I'm trying to test for an empty array or not and rather than an empty array I get:
Array ( [0] => [1] => [2] => [3] => ) This never registers as "empty". As far as I can tell I need the "else" syntax on there otherwise it fails.
Is there something else I can use besides NULL or FALSE? Or any other way to format it? I like this format because I have around 600 of these and it makes it much easier to read. Any suggestions?
var_dumpinstead ofprint_r, you would see that the array containsfalse.