What is the correct syntax for using elseif in PHP conditional statements?

When using elseif in PHP conditional statements, it is important to remember the correct syntax to avoid any errors. The correct syntax for elseif is to use it after an if statement and before the else statement. This allows you to check multiple conditions in a more organized way.

if (condition1) {
    // code block to be executed if condition1 is true
} elseif (condition2) {
    // code block to be executed if condition2 is true
} else {
    // code block to be executed if all conditions are false
}