Skip to content

Instantly share code, notes, and snippets.

@iconte
Created November 4, 2016 13:28
Show Gist options
  • Save iconte/e2afc27c4670b1d0a6e207a3761781ba to your computer and use it in GitHub Desktop.
Save iconte/e2afc27c4670b1d0a6e207a3761781ba to your computer and use it in GitHub Desktop.
remove espaços em excesso entre palavras
<?php
$frase = " Gosto de programar em PHP ";
$frase2 = trim(preg_replace('/ +/',' ' , $frase));
echo $frase2;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment