search

Home  >  Q&A  >  body text

After defining a variable, by default the first statement is true and the second statement is false, right?

<?php

$a=true;

if($a){

echo'rich';

echo'buy snacks';

}

else{

echo'no money';

echo'can't afford it';

}


?>


手机用户1571880571手机用户15718805711947 days ago1245

reply all(3)I'll reply

  • 卢小强

    卢小强2019-10-25 13:36:45

    Then the second one is FALSE,

    reply
    0
  • 卢小强

    卢小强2019-10-25 08:41:30

    You can add another if ($a=false) {echo '!!!!1'} to the if to see the result

    reply
    0
  • 手机用户1571880571

    After changing $a to false, the second result will be output

    手机用户1571880571 · 2019-10-25 09:10:45
  • Cancelreply