Last active
August 29, 2015 13:58
-
-
Save sbarrat/10113792 to your computer and use it in GitHub Desktop.
Función para quitar espacios en blanco extras dentro de los textos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function quitaEspacios($texto) | |
{ | |
$partes = explode(' ', $texto); | |
$textoLimpio = ""; | |
foreach ($partes as $parte) { | |
if (strlen($parte) > 0 || $parte != "") { | |
$nombreLimpio .= $parte." "; | |
} | |
} | |
return trim($nombreLimpio); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment