Posted By

shengyongjiang on 11/01/12


Tagged

php


Versions (?)

PHP function:remove_whitespace


 / Published in: PHP
 

  1. <?php
  2. function remove_whitespace($string) {
  3. $string = preg_replace('/\s+/', ' ', $string);
  4. $string = trim($string);
  5. return $string;
  6. }
  7.  
  8. ?>

Report this snippet  

You need to login to post a comment.