(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype_lower — 檢查小寫字元
text
被測試的字串。
注意事項:
如果提供 -128 到 255 之間(含)的 整數 (int),它會被解讀為單個字元的 ASCII 值(負值會加上 256,以便允許擴展 ASCII 範圍中的字元)。任何其他整數會被解讀為包含該整數十進位數字的字串。
自 PHP 8.1.0 起,不建議傳遞非字串的引數。未來,該引數將會被解讀為字串,而不是 ASCII 字碼點。根據預期的行為,應該將引數強制轉換為 字串 (string) 或明確呼叫 chr() 函式。
範例 #1 ctype_lower() 範例(使用預設語系設定)
<?php
$strings = array('aac123', 'qiutoas', 'QASsdks');
foreach ($strings as $testcase) {
if (ctype_lower($testcase)) {
echo "字串 $testcase 全由小寫字母組成。\n";
} else {
echo "字串 $testcase 並非全由小寫字母組成。\n";
}
}
?>
上述範例將輸出:
The string aac123 does not consist of all lowercase letters. The string qiutoas consists of all lowercase letters. The string QASsdks does not consist of all lowercase letters.