Some minor php Problems

Source: Internet
Author: User

Sort out two pieces for everyone to learn

1. Differences between three equal signs and two equal signs "=" VS "="

For example, a function returns the following results:
1. number greater than 0
2. Number smaller than 0
3. number equal to 0 (that is, 0)
4. False (upon failure)
In this case, if you want to capture the failure, you must use = instead of =
Because = matches 4th cases and 3rd cases, because 0 is false!

Next

$ A = '2'; // balanced type 2
$ B = 2; // numeric type 2
$ A = $ B, yes, both are 2
$ A ===$ B, which is incorrect because $ a is numeric and $ B is Numeric. Although the values are the same, they are of different types.


2. What are the three angle brackets in php? "<"
Copy codeThe Code is as follows:
$ Somevar = <someword
Put your code or words here
Someword;

This is a code snippet. One advantage of using code segments in PHP is that when you need to output a piece of code (including multiple lines), the code segment can maintain a more logical form. It is often used to insert HTML code.

Note that someword is any character, indicating a mark. <Someword indicates that the tag starts, and the last someword indicates that the code segment ends. And this someword must be written in the top level (there cannot be any characters such as spaces or tabs in front)

It can be used to assign values that contain both single quotes and double quotes.

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.