Your Ad Here

Posted By

tasmanweb on 04/30/11


Tagged

php function sanitize


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

HalfWinter


spaces2space: reduces multiple spaces to a single one in strings or arrays


 / Published in: PHP
 

  1. /* reduces multiple spaces to a single one in strings or arrays
  2. Usage: $result = spaces2space($variable); */
  3. function spaces2space($variable) {
  4. return (!is_array($variable)) ? preg_replace('/\s\s+/', ' ', $variable) : array_map('spaces2space',$variable);
  5. }

Report this snippet  

You need to login to post a comment.