


How to understand this judgment expression ((DEBUG_MODE 2) == 2)_PHP tutorial
How to understand this judgment expression ((DEBUG_MODE & 2) == 2)
((DEBUG_MODE & 2) == 2)//If this sentence is to be true, it must be ((2 & 2)==2). How do you understand this formula?
define('DEBUG_MODE',false);//If yes 2, execution will display 1
if ((DEBUG_MODE & 2) == 2)
{
$smarty = '1';
}
else
{
$smarty= '0';
}
echo $smarty;
?>
Copy code [ ]
D8888D reply content------------------------------------------------- ----------
"=&" What kind of operator is this?
$user =& init_users();
D8888D reply content------------------------------------------------- ----------
It’s a reference, but I don’t know what the use of adding & in front of the function is.
D8888D reply content------------------------------------------------- ----------
The AND operation in bit operations...
D8888D reply content------------------------------------------------- ----------
Let me explain
In fact, the 2 here should be a fixed value, a constant that defines your mode. It will be easier to understand if you write it like this
define('MODE_A',2);
$now_mode = 2;
if(($now_mode & MODE_A) == MODE_A){
echo "The current mode is MODE_A";
}
?>
Copy the code. Some students said, why not use == to judge directly? In fact, there is another meaning here, which is the included relationship
For example, the value of 6 & 2 is 2, and the value of 6&3 is also 2, and 2 != 3
This method can often represent a range. Compare the relationship between IP and subnet mask in computer networks to understand
D8888D reply content------------------------------------------------- ----------
Thank you LS, your answer is easy to understand.
D8888D reply content------------------------------------------------- ----------
Original post posted by lmhllr on 2007-12-17 17:27 [url=http://www.111cn.cn/bbs/redirect.php?goto=findpost&pid=335104&ptid=46748]Link tag[img]http:// www.111cn.cn/bbs/images/common/back.gif[/img][/url]
The AND operation in bit operations...
Can you explain its function? I still don’t understand the purpose of writing this way.
D8888D reply content------------------------------------------------- ----------
Original post by jayliu on 2007-12-17 16:55 [url=http://www.111cn.cn/bbs/redirect.php?goto=findpost&pid=335044&ptid=46748]Link tag[img]http:// www.111cn.cn/bbs/images/common/back.gif[/img][/url]
It’s a reference, but I don’t know what the use of adding & in front of the function is.
Added&
The function return value is a reference
PHP5 defaults to reference, and you cannot use & randomly. In PHP5, if the function directly returns false, the function with & will hang, and PHP will not be able to find the reference address
D8888D reply content------------------------------------------------- ----------
I learned something new from LS. Thank you[img]http://www.111cn.cn/bbs/images/smilies/default/victory.gif[/img]
D8888D reply content------------------------------------------------- ----------
So that’s it

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



As a world-renowned sports brand, Nike's shoes have attracted much attention. However, there are also a large number of counterfeit products on the market, including fake Nike shoe boxes. Distinguishing genuine shoe boxes from fake ones is crucial to protecting the rights and interests of consumers. This article will provide you with some simple and effective methods to help you distinguish between real and fake shoe boxes. 1: Outer packaging title By observing the outer packaging of Nike shoe boxes, you can find many subtle differences. Genuine Nike shoe boxes usually have high-quality paper materials that are smooth to the touch and have no obvious pungent smell. The fonts and logos on authentic shoe boxes are usually clear and detailed, and there are no blurs or color inconsistencies. 2: LOGO hot stamping title. The LOGO on Nike shoe boxes is usually hot stamping. The hot stamping part on the genuine shoe box will show

What is the resolution of Savior Y7000P when playing CF? The resolution of Savior Y7000P when playing CF is 1920*1080. Because this computer is equipped with a GTX1650 graphics card and an i5-9300H processor, its performance is relatively good and sufficient to meet the needs of games such as CF. At the same time, 1920*1080 is the current resolution of mainstream e-sports monitors, and the image quality and clarity are sufficient. In addition, if there are players with higher requirements, you can appropriately lower the game image quality settings to obtain a smoother gaming experience. In order to enjoy a clearer visual experience, you can adjust the resolution of the Savior y7000p to 2560*1400. This way, you will be able to enjoy higher quality image display. Equipped with the Savior Y7000P 2022 model

Question: How to determine whether the date is the previous day in Go language? In daily development, we often encounter situations where we need to determine whether the date is the previous day. In the Go language, we can implement this function through time calculation. The following will be combined with specific code examples to demonstrate how to determine whether the date is the previous day in Go language. First, we need to import the time package in the Go language. The code is as follows: import("time") Then, we define a function IsYest

jQuery is a JavaScript library widely used in web development. It provides many simple and convenient methods to operate web page elements and handle events. In actual development, we often encounter situations where we need to determine whether a variable is empty. This article will introduce several common methods of using jQuery to determine whether a variable is empty, and attach specific code examples. Method 1: Use the if statement to determine varstr="";if(str){co

How to tell if a jQuery element has a specific attribute? When using jQuery to operate DOM elements, you often encounter situations where you need to determine whether an element has a specific attribute. In this case, we can easily implement this function with the help of the methods provided by jQuery. The following will introduce two commonly used methods to determine whether a jQuery element has specific attributes, and attach specific code examples. Method 1: Use the attr() method and typeof operator // to determine whether the element has a specific attribute

A SQL file is a text file that usually contains a series of SQL statements. To open a SQL file, you can use a text editor or a specialized SQL development tool. The easiest way to open a SQL file is with a text editor, such as Notepad or Notepad++ in Windows, or Text Editor in Mac. Here are the steps to open a SQL file: First, find the SQL file you want to open, right-click the file, and select "Open with". in the pop-up window

When AI Ideograms compete for realism and artistic sense, Ideogram has opened up a tricky track: it can accurately generate text on pictures, and the fonts and layouts are beautiful. This demand is not niche. Generate posters and illustrations with one click without using P-pictures. It can save a lot of trouble and is very suitable for ordinary people who know nothing about design. We previously wrote about version 1.0 of Ideogram. On August 21st, version 2.0 came. The realism is better, the posters are more designed, and the special skill of text is also stronger. You may have never heard of it. This is an AI product developed by former Google employees. It has many shortcomings, but the longboard can "overtake" Midjourney in corners. Directions https://ideogram.ai/A

PHP is a scripting language widely used in website development. For developers, it is often necessary to determine whether a field is empty. In PHP, determining whether a field is empty can be achieved through some simple methods. This article will introduce how to determine whether a field is empty in PHP, and provide specific code examples for your reference. In PHP, you can usually use the empty() function or isset() function to determine whether a field is empty. Next, we introduce the usage of these two functions respectively. Use the empty() function
