咨询一个PHP & 操作的问题

WBOY
Release: 2016-06-23 13:55:02
Original
919 people have browsed it


               其中 os_type为3  os_rs['app_key'] 为134217728也就是 16进制的 8000000

                echo "#########"."
";
                echo $os_type." ".$os_rs['app_key']."
";
                echo  ($os_type)&($os_rs['app_key']);  ==》结果是1
                echo "
";
                echo  (3)&($os_rs['app_key']);  ===》 结果为0 是正常的
                echo "
";
                echo  (268435455)&($os_rs['app_key']);  ===》 结果为 134217728 也正常
                echo "
";
                echo  $os_type&134217728; ===》 结果为0 是正常的
                echo "
";

                echo "

";
                echo "                 if($flag != 0)
                        echo "checked=\"checked\" ";
                echo ">";
                echo "$app_str";
                echo "";
                echo "";


               奇怪的是为什么2个变量&操作的结果为1,是不是涉及了符号的问题


回复讨论(解决方案)

$os_type = 3;$os_rs['app_key'] = 134217728;var_dump( $os_type & $os_rs['app_key'] );
Copy after login
Copy after login
int(0)

$os_type = 3;$os_rs['app_key'] = 134217728;var_dump( $os_type & $os_rs['app_key'] );
Copy after login
Copy after login
int(0)

情况比想象的要负责一点,在{}内赋值和{}外赋值结果还不一样

我???行是0的。

echo  ($os_type)&($os_rs['app_key']); //0

还有什么复杂情况,你说出来看看

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template