WP_Filesystem_Base::is_binary() WordPress Method
The WP_Filesystem_Base::is_binary() method is used to check if a file is binary or not. This is useful when dealing with text files, as some text editors will treat binary files as if they are text files.
WP_Filesystem_Base::is_binary( string $text ) #
Determines if the string provided contains binary characters.
Contents
Parameters
- $text
(string)(Required)String to test against.
Return
(bool) True if string is binary, false otherwise.
Source
File: wp-admin/includes/class-wp-filesystem-base.php
public function is_binary( $text ) { return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127) }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |