strcmp(date(‘Y-m-d’,$user->last_time), date(“Y-m-d”,time())) == 0
代码如下 |
复制代码 |
echo strncasecmp("abcdd", "abcde", 3);
|
If you don’t want to distinguish between uppercase and lowercase letters
代码如下 |
复制代码 |
$a='aa';
$b='www.bKjia.c0m';
if( $a == $b )
{
echo '相等';
}
else
{
echo '不等';
}
|
strncasecmp is used to compare part of a string in a case-insensitive manner, starting from the beginning of the string. The third parameter is the length to be compared:
The code is as follows
|
Copy code
代码如下 |
复制代码 |
22 == "22"; // 返回 true
22 === "22"; // 返回false
|
|
|
echo strncasecmp("abcdd", "abcde", 3);
// Returns 0, compared abc and abc, since they are not case sensitive, they are the same
We can also use == to compare PHP strings, such as
The code is as follows
|
Copy code
$a='aa';
$b='www.bKjia.c0m';
if( $a == $b )
{
echo 'Equal';
}
else
echo 'not equal';
}
You can also use === to compare
The code is as follows
|
Copy code
|
22 == "22"; // returns true
22 === "22"; // return false
http://www.bkjia.com/PHPjc/628890.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/628890.htmlTechArticleThe strcmp() function is used to compare two strings. If the two strings are completely equal, we will return 0 , otherwise there will be various return values. This function is not case-sensitive. Friends in need can refer to...
|
|
|
|
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn