Is it possible to clear all the additional white space in a text before it insert into database? I tried trim() but it only clear the beginning and end white space. Is there a function that clear the white space between characters?
eg. Hello Bob becomes Hello Bob
Please help
Thanks in advance
if you want no spaces between words use: $string=str_replace(" ","",$your_text);
Sorry I didn't mean I don't want any space between words. But I only need one space between each word Is this can be done??
Thanks
finds any instance of more than one white space and replaces it with one blank
$clean_value = preg_replace( '/\s{2,}/', ' ', $value );