码迷,mamicode.com
首页 > 其他好文 > 详细

strcmp()

时间:2017-02-05 10:54:09      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:ret   一段   int   content   array   out   use   ref   比较   

在官方的文档有这么一端说明:
Note a difference between 5.2 and 5.3 versions

echo (int)strcmp(‘pending‘,array());
will output -1 in PHP 5.2.16 (probably in all versions prior 5.3)
but will output 0 in PHP 5.3.3

Of course, you never need to use array as a parameter in string comparisions.
大概意思就是5.3的之前和之后版本在使用strcmp比较数组和字符串时候的差异。 在5.3的版本之后使用这个函数比较会返回0,太令人迷恋了。。。
<?php
#$a=‘Hello world!‘;
$password=$_GET[‘password‘];
#$a=True;
#echo gettype($a);
if(strcmp(‘Firebroo‘,$password)){
    echo ‘NO!‘;
}else{
    echo ‘YES!‘;
}
#echo ord(‘a‘);
?>
这样一段代码,原本的意图是输入Firebroo才能获得权限,但是在5.3版本之后捏,You just need input an array ,like this(?password[]=1) 看图技术分享  

查看原文:http://www.am0s.com/functions/201.html

strcmp()

标签:ret   一段   int   content   array   out   use   ref   比较   

原文地址:http://www.cnblogs.com/qiniuyhm/p/6366922.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!