PHP strcmp() 函数
比较两个字符串(区分大小写):
<?php
echo strcmp("Hello world!","Hello world!");
?>
echo strcmp("Hello world!","Hello world!");
?>
定义和用法
strcmp() 函数比较两个字符串。
注释:strcmp() 函数是二进制安全的,且区分大小写。
提示:该函数与
实例 2
不同的返回值:
<?php
echo strcmp("Hello world!","Hello world!"); // the two strings are equal
echo strcmp("Hello world!","Hello"); // string1 is greater than string2
echo strcmp("Hello world!","Hello world! Hello!"); // string1 is less than string2
?>
echo strcmp("Hello world!","Hello world!"); // the two strings are equal
echo strcmp("Hello world!","Hello"); // string1 is greater than string2
echo strcmp("Hello world!","Hello world! Hello!"); // string1 is less than string2
?>
版权声明:本页面内容旨在传播知识,为用户自行发布,若有侵权等问题请及时与本网联系,我们将第一时间处理。E-mail:284563525@qq.com