WordPress开发者和主题制作者的搜索引擎



normalize_whitespace ›

Since2.7.0
已弃用n/a
normalize_whitespace ( $str )
参数:
  • (string) $str The string to normalize.
    Required: Yes
返回:
  • (string) The normalized string.
定义在:
文档:

Normalize EOL characters and strip duplicate whitespace.



源码

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