📌  相关文章
📜  从字符串 php foreach 中删除最后一个逗号 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:15.630000             🧑  作者: Mango

代码示例4
//dont print last comma after string print using foreach loop

hasComma = false;
foreach ($this->sinonimo as $s){ 
    if (hasComma){ 
        echo ","; 
    }
    echo ''.ucfirst($s->sinonimo).'';
    hasComma=true;
}