课程: PHP for WordPress (2020)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Creating if/else statements

Creating if/else statements

- [Instructor] Control structures are used in PHP to employ logic to our code and make things happen based on a set of criteria. All of the decision-making in a program happens because of control structures. This is also where we'll use boolean statements most often. The most common control structure is if statements. An if statement will check for a condition to be true, and if it's true it will execute a specific set of code. Here's an example. If the variable A is greater than the variable B, then we want to echo the statement A is greater than B. Notice I'm using single quotes here, so I want the actual variable to be printed and not the value the variable is representing. This is a complete statement. There is no other code required, and what it says in plain English is if the condition A is greater than B is true, execute the following code. However, there is more code that we can add to it. First, we can add an…

内容