<?php $string = "My text has so much whitespace Plenty of spaces and tabs"; //Remove duplicate newlines $string = preg_replace("/[\n]*/", "\n", $string); //Preserves newlines while replacing the other whitspaces with single space var_export( preg_replace("/[ \t]*/", " ", $string) );
You have javascript disabled. You will not be able to edit any code.