概述
ctype函数
PHP ctype_space()函数 (PHP ctype_space() function)
ctype_space() function is a character type (CType) function in PHP, it is used to check whether a given string contains whitespace or not.
ctype_space()函数是PHP中的字符类型(CType)函数,用于检查给定的字符串是否包含空格。
Note: Whitespace contains some of the other things like "tabs" (horizontal, vertical), "line feed", "carriage return", and "form feed".
注意:空格包含其他一些内容,例如“制表符”(水平,垂直),“换行符”,“回车”和“换页符”。
It returns true – if the string contains whitespaces, else it returns false.
它返回true –如果字符串包含空格,则返回false 。
Syntax:
句法:
ctype_space(string) : bool
Example:
例:
Input: "rn"
Output: true
Input: " "
Output: true
Input: "Hello world"
Output: false
PHP code:
PHP代码:
<?php
$str = " ";
if(ctype_space($str))
echo ("$str contains whitespaces.n");
else
echo ("$str does not contain whitespaces.n");
$str = "rn";
if(ctype_space($str))
echo ("$str contains whitespaces.n");
else
echo ("$str does not contain whitespaces.n");
$str = "Hello world123";
if(ctype_space($str))
echo ("$str contains whitespaces.n");
else
echo ("$str does not contain whitespaces.n");
$str = "[email protected]&a";
if(ctype_space($str))
echo ("$str contains whitespaces.n");
else
echo ("$str does not contain whitespaces.n");
?>
Output
输出量
contains whitespaces.
contains whitespaces.
Hello world123 does not contain whitespaces.
[email protected]&a does not contain whitespaces.
翻译自: https://www.includehelp.com/php/ctype_space-function-with-example.aspx
ctype函数
最后
以上就是包容发夹为你收集整理的ctype函数_PHP ctype_space()函数与示例的全部内容,希望文章能够帮你解决ctype函数_PHP ctype_space()函数与示例所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复