Home  >  Article  >  Backend Development  >  Some minor problems with php_PHP tutorial

Some minor problems with php_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:36:42721browse

I have sorted out 2 for everyone to learn from

1. The difference between three equal signs and two equal signs "===" VS "=="

For example Your function will return these situations:
1. Number greater than 0
2. Number less than 0
3. Number equal to 0 (that is, 0)
4. False ( When it fails)
If you want to capture the failure situation at this time, you must use ===, not ==
Because == will not only match the 4th situation, but also the 3rd one situation, because 0 is also false!

Here comes one

$a='2';//Character type 2
$b=2;//Numeric type 2
$a==$b, Yes, both are 2
$a===$b, which is wrong because $a is character type and $b is numeric type. Although the value is the same, the type is different.


2. What are the three angle brackets in PHP? "<<<"

Copy code The code is as follows:

$somevar = <<put your code or words here
someword;

Here is the code snippet. One benefit of using code snippets in PHP is that when you need to output a piece of code (which can include multiple lines), the code snippet can maintain a more logical form. Often used to insert HTML code.

Note that someword is any character and represents a mark. <<
can be used to include both single quotes and double quotes in assignments. Well, there are many such in pw

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322097.htmlTechArticleI compiled 2 for everyone to learn: 1. The difference between three equal signs and two equal signs"== =" VS "==" For example, your function will return the following situations: 1. A number greater than 0 2, a number less than 0 3, etc...
Statement:
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