note 83115 deleted from function.str-replace by danbrown

From: Date: Sun, 20 Jul 2008 16:14:20 +0000
Subject: note 83115 deleted from function.str-replace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142166@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- <?php function str_clean($str) { // KG6YPI, Brandon Hansen // removes extra whitespaces and new lines // while preserving spaces in words, sentances, etc. $strip_this=array(" ","\n","\r"); // convert to our own special marker $str=str_replace($strip_this,"<!ypi!>",$str); // remove doubles $str=str_replace("<!ypi!><!ypi!>","",$str); // convert singles to spaces and trim $str=trim(str_replace("<!ypi!>"," ",$str)); return $str; } ?>

« previous php.notes (#142166) next »