WP_Filesystem_Base::is_binary( string $text ): bool

In this article

Determines if the string provided contains binary characters.

Parameters

$textstringrequired
String to test against.

Return

bool True if string is binary, false otherwise.

Source

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

Changelog

VersionDescription
2.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.