IntlChar::isprint

(PHP 7, PHP 8)

IntlChar::isprintCheck if code point is a printable character

Beschreibung

publicstaticIntlChar::isprint(int|string$codepoint): ?bool

Determines whether the specified code point is a printable character.

true for general categories other than "C" (controls).

Parameter-Liste

codepoint

Ein Wert vom Typ int, der einen Codepoint darstellt (z. B. 0x2603 für U+2603 SNOWMAN) oder ein als UTF-8-String kodiertes Zeichen (z. B. "\u{2603}")

Rückgabewerte

Returns true if codepoint is a printable character, false if not. Returns null on failure.

Beispiele

Beispiel #1 Testen unterschiedlicher Codepoints

<?php
var_dump
(IntlChar::isprint("A"));
var_dump(IntlChar::isprint(" "));
var_dump(IntlChar::isprint("\n"));
var_dump(IntlChar::isprint("\u{200e}"));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(true) bool(true) bool(false) bool(false)

Siehe auch

To Top