Some small problems with PHP _php tips

Source: Internet
Author: User
Sort out 2 people to learn and learn

1, three equals sign and two equal sign difference "= = =" VS "= ="

For example, you can return a function in these situations:
1, the number greater than 0
2, less than 0 of the number
3, equal to 0 of the number (that is, 0)
4, False (when failed)
If you want to catch failure, you must use = = =
because = = except will match the 4th case, will also match the 3rd case, because 0 is also false!

In a

$a = ' 2 ';//character Type 2
$b =2;//Value type 2
$a = = $b, it's right, it's all 2.
$a = = = $b, is not correct, because $a is a character $b is a numeric type, the value is the same, but the type is different.


2, PHP three angle bracket is to do what "<<<"
Copy Code code as follows:

$somevar = <<<someword
Put your code or words here
Someword;

This is the code snippet. The advantage 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 that represents the meaning of a tag. The <<<someword represents the start of the tag, and the final Someword represents the end of the code segment. And this someword must be written below (no spaces or tabs can be preceded by any character)

Can be used for assignments that contain both single and double quotes en pw Many of these

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.