Created
March 18, 2016 06:57
-
-
Save jazlopez/6c883d57f77c0755d5da to your computer and use it in GitHub Desktop.
Simple trim and replace multiple whitespaces from string
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
/** | |
* | |
* Trim and replace multiple whitespaces | |
* @param $value | |
* | |
* @return mixed | |
*/ | |
public function sanitize($value){ | |
return preg_replace('/\s+/', ' ', trim($value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment