例1$string = trim(preg_replace('/\s\s+/', ' ', $string));多個空格和換行被替換為一個空格。 例2$string = trim(preg_replace('/\s\s+/', '', $string));刪除多個空格和換行。