2
I am bringing the following information from a form:
$seg = "Seg";
$ter = "Ter";
$qua = "Qua";
$qui = "Qui";
Only in many cases, some of these fields will come empty, ex.:
$seg = "Seg";
$ter = "Ter";
$qua = "";
$qui = "Qui";
I’d like to take this information and put a comma between the words, like this:
Seg,Ter,Qui
I tried it this way, but it didn’t work:
$diasPromocoes = $seg.",".$ter.",".$qua.",".$qui;
$dividir = explode(",",$diasPromocoes);
echo implode(",",$dividir);
Is returning:
Seg,Ter,,Qui