I'm bringing the following information from a form:
$seg = "Seg";
$ter = "Ter";
$qua = "Qua";
$qui = "Qui";
In many cases, some of these fields will be empty, eg:
$seg = "Seg";
$ter = "Ter";
$qua = "";
$qui = "Qui";
I would like to get this information and put a comma between words, like this:
Seg,Ter,Qui
I tried the following, but it did not work:
$diasPromocoes = $seg.",".$ter.",".$qua.",".$qui;
$dividir = explode(",",$diasPromocoes);
echo implode(",",$dividir);
Returning:
Seg,Ter,,Qui