Php-function-ctype-space

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

PHP-関数ctype_space()

構文

ctype_space ( $text );

定義と使い方

この関数は、指定された文字列textのすべての文字が空白を作成するかどうかをチェックします。

パラメーター

Sr.No Parameter & Description
1

text(Required)

テストされた文字列。

戻り値

テキスト内のすべての文字が何らかの空白を作成する場合はTRUEを返し、そうでない場合はFALSEを返します。 空白文字の他に、タブ、垂直タブ、ラインフィード、キャリッジリターン、フォームフィード文字も含まれます。

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

<?php
   $strings = array('\n\r\t', '\test123' );

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

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

\n\r\t does not have all whitespace characters.
\test123 does not have all whitespace characters.