Categories

if…else

Guillaume Dumas March 18, 2016
No votes yet.
Please wait...

Very often when you write code, you want to perform different actions for different conditions. You can use conditional statements in your code to do this.

The if….else statement executes some code if a condition is true and another code if that condition is false.

The if….else syntaxt in PHP is similar to the one in JavaScript and any other C-like language.

if (condition) {
    code to be executed if condition is true;
} else {
    code to be executed if condition is false;
}

The condition can be any expression that result into a boolean value (true or false), for example:

if ($number_of_posts > 9) {
    show_breadcrumbs();
}
Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket

Comments are closed.