wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



normalize_whitespace › WordPress Function

Depuis2.7.0
Dépréciéen/a
normalize_whitespace ( $str )
Paramètres:
  • (string) $str The string to normalize.
    Requis: Oui
Retourne:
  • (string) The normalized string.
Défini(e) dans:
Codex:

Normalizes EOL characters and strips duplicate whitespace.



Source

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