Today, I found an article in PHP that introduces a space in a replacement string in a comma ', ' and keeps a diary.
Copy CodeThe code is as follows:
/*
* The space in the keyword is replaced by ', '
*/
Public Function Emptyreplace ($STR) {
$str = Str_replace (', ', ', $str); Replace full-width spaces as half-width
$str = Str_replace (', ', ', $str); Replace consecutive spaces with one
$noe = false; If a character that is not a space is encountered
for ($i =0; $i
if ($noe && $str [$i]== ') $str [$i] = ', ';//If a character that is not a space appears before the current space
ElseIf ($str [$i]!= ') $noe =true;
The current character is not a space, defined $noe variable
}
return $str;
}
?>
http://www.bkjia.com/phpjc/781035.html< /span>www.bkjia.com True http://www.bkjia.com/phpjc/781035.html techarticle Today, I found an article in PHP that introduces a space in a replacement string in a comma ', ' and keeps a diary. Copy the code as follows: Pre name= "code" class= "PHP"?
PHP/* * off ...