I have this array:
$bonusarraymain = array(
array( "bonus1"=> "Testitem" ,
),
array( "bonus2"=> "" ,
),
array( "bonus3"=> "444" ,
),
array( "bonus4"=> "" ,
)
);
I want to echo out the values which aren´t empty. The values should also be separated with a comma between each other. There shouldn´t be a comma after the last value.
This is how I output the values, but how can I separate them with commas?
foreach ($bonusarraymain as $bonus) {
echo $bonus['bonus1'];
echo $bonus['bonus2']['0'];
echo $bonus['bonus2']['1'];
echo $bonus['bonus3'];
echo $bonus['bonus4'];
}