WP_Filesystem_Base::is_binary()publicWP 2.7.0

Determines if the string provided contains binary characters.

Method of the class: WP_Filesystem_Base{}

No Hooks.

Return

true|false. True if string is binary, false otherwise.

Usage

$WP_Filesystem_Base = new WP_Filesystem_Base();
$WP_Filesystem_Base->is_binary( $text );
$text(string) (required)
String to test against.

Changelog

Since 2.7.0 Introduced.

WP_Filesystem_Base::is_binary() code WP 6.5.2

public function is_binary( $text ) {
	return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
}