Php-function-ctype-upper

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

PHP-関数ctype_upper()

構文

ctype_upper ( $text );

定義と使い方

この関数は、指定された文字列、テキスト内のすべての文字が大文字であるかどうかをチェックします。

パラメーター

Sr.No Parameter & Description
1

text(Required)

テストされた文字列。

戻り値

テキスト内のすべての文字が現在のロケールの大文字である場合、TRUEを返します。

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

<?php
   $strings = array('test12345', 'ABCEFG');

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

これにより、次の結果が生成されます–

test12345 does not have all uppercase letters.
ABCEFG consists of all uppercase letters.