I just want to ask, can I write php code like this? True and flase are not used.

Source: Internet
Author: User
I just want to ask, can I write php code like this? True and flase are not used.

Liang Jingru

$ Abc = 4/2;
If ($ abc = 2 ){
Echo $ abc = true;
Else {
Echo $ abc = false ;;
?>


Reply to discussion (solution)

Liang Jingru
 

Why not enclose the brackets? The java language must be enclosed in parentheses in the if clause.

Liang Jingru
 

The landlord, the single equal sign is a value, not a judgment.
You assign $ abc to 2 in if, non-zero, true, and else meaningless.
The values after echo should also be converted to the double equal sign to determine whether the values are equal.
In this case, if the value of $ abc is 2 $ abc = true, the result is 1.

You saved the file in. php format!



Liang Jingru

$ Abc = 4/2;
If ($ abc = 2)
Echo $ abc = true;
Else
Echo $ abc = false ;;
?>

If ($ abc = 2)
"=" Indicates that the value assignment is not a comparison.


= Value = Compare content = compare address and content

If ($ abc = 2) {// $ abc = 2

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.