Php-function-ctype-graph

提供:Dev Guides
移動先:案内検索

PHP-関数ctype_graph()

構文

ctype_graph ( $text );

定義と使い方

この関数は、指定された文字列textのすべての文字が可視出力を作成するかどうかを確認します。

パラメーター

Sr.No Parameter & Description
1

text(Required)

テストされた文字列。

戻り値

テキスト内のすべての文字が印刷可能で、実際に目に見える出力(空白なし)を作成する場合はTRUEを返し、そうでない場合はFALSEを返します。

次の例を試してください-

<?php
   $strings = array('asdf\n\r\t', 'arf12', 'LKA#@%.54');

   foreach ($strings as $test) {
      if (ctype_graph($test)) {
         echo "$test consists of all (visibly) printable characters \n";
      }else {
         echo "$test does not have all (visibly) printable characters. \n";
      }
   }
?>

これは、次の結果を生成します-

asdf\n\r\t consists of all (visibly) printable characters.
arf12 consists of all (visibly) printable characters
LKA#@%.54 consists of all (visibly) printable characters