My little brother just wants to ask, can you write PHP code like this? True and flase are not used.

Source: Internet
Author: User


<title>Fish Leong</title>

$ABC =4/2;
if ($abc =2) {
echo $ABC =true;
else{
echo $abc =false;;
?>


Reply to discussion (solution)

Fish Leong
 
  

Why don't you tie the brackets? The Java language has to be bracketed in if.

Fish Leong
 
  

Landlord Ah, single equals is assignment, not judge Ah
You assign a value of $ABC to 2, nonzero, true and else meaningless in if.
Echo should also be replaced by a double equal sign to determine whether it is equal
At this point the value of $ABC is 2 $abc = = True The result is 1

The first question is that you save the file in. php format!



Fish Leong

$ABC = 4/2;
if ($abc = = 2)
echo $ABC = true;
Else
echo $abc = false;;
?>

if ($abc =2)
"=" is an assignment that is not a comparison


= Assignment = = Compare Content = = = Compare address and content

if ($abc =2) {//$ABC ==2

  • Related Article

    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.