Mike42\Escpos\PrintBuffers\EscposPrintBuffer::asciiCheck PHP Method

asciiCheck() private static method

Return true if a character is an ASCII printable character.
private static asciiCheck ( string $char, boolean $extended = false ) : boolean
$char string Character to check
$extended boolean True to allow 128-256 values also (excluded by default)
return boolean True if the character is printable, false if it is not.
    private static function asciiCheck($char, $extended = false)
    {
        if (strlen($char) != 1) {
            // Multi-byte string
            return false;
        }
        $num = ord($char);
        if ($num > 31 && $num < 127) {
            // Printable
            return true;
        }
        if ($num == 10) {
            // New-line (printer will take these)
            return true;
        }
        if ($extended && $num > 127) {
            return true;
        }
        return false;
    }