wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



normalize_whitespace › WordPress Function

Od2.7.0
Przestarzałyn/a
normalize_whitespace ( $str )
Parametry:
  • (string) $str The string to normalize.
    Wymagane: Tak
Powrót:
  • (string) The normalized string.
Zdefiniowane na:
Codex:

Normalizes EOL characters and strips duplicate whitespace.



Źródło

function normalize_whitespace( $str ) {
	$str = trim( $str );
	$str = str_replace( "\r", "\n", $str );
	$str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
	return $str;
}