Using AND/OR in if else PHP statement

后端 未结 10 1921
梦如初夏
梦如初夏 2020-12-12 19:16

How do you use \'AND/OR\' in an if else PHP statement? Would it be:

1) AND

if ($status = \'clear\' AND $pRent == 0) {
    mysql_query(\"UPDATE rent 
         


        
10条回答
  •  轮回少年
    2020-12-12 20:03

    i think i am having a bit of confusion here. :) But seems no one else have ..

    Are you asking which one to use in this scenario? If Yes then And is the correct answer.

    If you are asking about how the operators are working, then

    In php both AND, && and OR, || will work in the same way. If you are new in programming and php is one of your first languages them i suggest using AND and OR, because it increases readability and reduces confusion when you check back. But if you are familiar with any other languages already then you might already have familiarized the && and || operators.

提交回复
热议问题