fork(1) download
  1. <?php
  2.  
  3. $arr = array('john', 'Cyrax', 'john', 'Sonia', 'Sector');
  4. $str = implode(' e ', $arr);
  5. $itens = count($arr);
  6. $str_formatada = preg_replace('/ e /', ', ', $str, count($arr)-2);
  7. echo $str_formatada;
Success #stdin #stdout 0.02s 24144KB
stdin
Standard input is empty
stdout
john, Cyrax, john, Sonia e Sector