a few words about web development

Replace multiple spaces with single ones

Simple solutions for copying&pasting
Solution without regular expressions:
$str = 'Hello      World!';

while (strpos('  ', $str) !== false)
{
    $str = str_replace('  ', ' ', $str);
}

Solution with regular expressions:
$str = 'Hello      World!';

$str = preg_replace('/  +/', ' ', $str);

Comments