>>790
echo preg_replace("|([^:/]{1})/+|", '$1/', 'http://example.com//foo///bar.html');