How to understand this formula (DEBUG_MODE2) 2 ). How to understand this sentence (DEBUG_MODE2) 2) if it is to be true, it is necessary to (2 is 2) execute to display 1if (DEBUG_MODE} else {$ smarty0 ;} echo $ smarty ;? How do I understand this formula for replication (DEBUG_MODE & 2) = 2)
(DEBUG_MODE & 2) = 2) // if this sentence is to be set up, it must be (2 & 2) = 2). how can this statement be understood?
Define ('debug _ mode', false); // if it is 2, 1 is displayed.
If (DEBUG_MODE & 2) = 2)
{
$ Smarty = '1 ';
}
Else
{
$ Smarty = '0 ';
}
Echo $ smarty;
?>
[]
D8888D reply content -------------------------------------------------------
"= &" What is this operator?
$ User = & init_users ();
D8888D reply content -------------------------------------------------------
Yes, but I do not know what to use in front of the function.
D8888D reply content -------------------------------------------------------
Bitwise operations and operations...
D8888D reply content -------------------------------------------------------
Let me explain it.
In fact, here 2 should be a fixed value, which is a constant that defines your mode. if you write it like this, it will be easy to understand.
Define ('mode _ A', 2 );
$ Now_mode = 2;
If ($ now_mode & MODE_A) = MODE_A ){
Echo "the current mode is MODE_A ";
}
?>
Some people said, why don't you use = for direct judgment? in fact, there is another significance here: the included relationship.
For example, the value of 6 & 2 is 2, and the value of 6 & 3 is 2, and the value of 2! = 3
This method usually represents a range. let's take a look at the relationship between the IP address and the subnet mask in the computer network.
D8888D reply content -------------------------------------------------------
Thanks. LS. your answer is easy to understand.
D8888D reply content -------------------------------------------------------
Original post published by lmhllr at [url = http://www.111cn.cn/bbs/redirect.php? Goto = findpost & pid = 335104 & ptid = 46748] link Mark [img] http://www.111cn.cn/bbs/images/common/back.gif?/img=#/url]
Bitwise operations and operations...
Can you explain his role? I still don't understand the intention of this writing.
D8888D reply content -------------------------------------------------------
Original post published by jayliu at [url = http://www.111cn.cn/bbs/redirect.php? Goto = findpost & pid = 335044 & ptid = 46748] link Mark [img] http://www.111cn.cn/bbs/images/common/back.gif?/img=#/url]
Yes, but I do not know what to use in front of the function.
Added &
Function return value is reference
Php5 is referenced by default and cannot be used in disorder. in php5, if the function returns false directly, the function with & is suspended, and php cannot find the referenced address.
D8888D reply content -------------------------------------------------------
I have learned new things from LS. thanks to [img] http://www.111cn.cn/bbs/images/smilies/default/policy.gif#/img].
D8888D reply content -------------------------------------------------------
It turns out like this.
Equals (DEBUG_MODE 2) = 2) // if this sentence is to be set up, it must be (2 // if 2 is, 1 if (DEBUG_MODE} else {$ smarty = '0';} echo $ smarty ;?> Copy...