Sandhurst Sandhurst - 8 months ago 64
PHP Question

Replace   with a blank or empty string PHP

Well, I have tried these and it seems that none of them are working, my example string is

$text_description="      Hello world! lorel ipsum";

$text_description= str_replace(" "," ",$text_description);
$text_description = preg_replace("/&#?[a-z0-9]+;/i"," ",$text_description);

$text_description="       Hello world! lorel ipsum";
$text_description = str_replace(' ', ' ', $text_description);
echo $text_description;


Hello world! lorel ipsum