In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the difference between false and 0 in php". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the difference between false and 0 in php".
The difference between php false and 0: 1. False is a Boolean value, while 0 is the value 0. In PHP, false is stored with a value of 0, but the type of false and 0 is not the same.
The operating environment of this paper: Windows7 system, PHP7.1, Dell G3.
What is the difference between php false and 0?
The difference between 0 and empty Null false in php
The reason is that variables are stored in C language structure in PHP, empty string and NULL,false are stored with a value of 0, where this structure has a member variable such as zend_uchar type;, which is used to hold the type of variable, while the type of empty string is string,NULL and the type of NULL,false is boolean.
You can use echo gettype (''); and echo gettype (NULL); to print this! The = operator not only compares values, but also compares types, so the third one is false!
So it can be said that = = is equal to the following function:
Function eq ($v1, $v2) {if ($v1 = = $v2 & & gettype ($v1) = = gettype ($v2)) {return 1;} else {return 0;}}
So the empty string (''), false,NULL and 0 are equal values but different types!
Note:
NULL is a special type.
NULL in both cases
1. $var = NULL
2. $var
3. "," 0, "0", NULL, FALSE, array (), var $var;, and objects without any attributes will be considered empty, and TRUE will be returned if var is empty.
Thank you for your reading, the above is the content of "what is the difference between false and 0 in php". After the study of this article, I believe you have a deeper understanding of the difference between false and 0 in php. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.