Php-function-ctype-print
提供:Dev Guides
PHP-関数ctype_print()
構文
ctype_print ( $text );
定義と使い方
この関数は、指定された文字列、テキスト内のすべての文字が印刷可能かどうかをチェックします。
パラメーター
Sr.No | Parameter & Description |
---|---|
1 |
text(Required) テストされた文字列。 |
戻り値
テキスト内のすべての文字が実際に出力(空白を含む)を作成する場合はTRUEを返します。 テキストに制御文字、または出力機能や制御機能をまったく持たない文字が含まれている場合は、FALSEを返します。
例
次の例を試してください-
<?php
$strings = array('asdf\n\r\t', 'k211', "fooo#int%@");
foreach ($strings as $test) {
if (ctype_print($test)) {
echo "$test consists of all printable characters. \n";
}else {
echo "$test does not have all printable characters. \n";
}
}
?>
これは、次の結果を生成します-
asdf\n\r\t consists of all printable characters.
k211 consists of all printable characters.
fooo#int%@ consists of all printable characters.