$headers=array(
$requestMethod." /rest/obj HTTP/1.1",
"listable-meta: ".$listablemeta,
"meta: ".$nonlistmeta,
'accept: */*',
);
In the above example, I'd like to omit the whole line if $listablemeta or $nonlistmeta is blank. Assume $listablemeta is blank. Then the array would be:
$headers=array(
$requestMethod." /rest/obj HTTP/1.1",
"meta: ".$nonlistmeta,
'accept: */*',
);
Now I can setup a conditional isempty() and set the array accordingly, but what if I want to construct an array with say 20 different values each only setting if the variable on each line is not empty, is there another way to set a conditional -within- an array declaration? If not, what is another way to approach this problem?
Thanks!