Sandhurst Sandhurst - 1 year ago 128
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);

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


Hello world! lorel ipsum

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download