What is the purpose of the "if" and "else" statements in PHP code?

The "if" and "else" statements in PHP are used for conditional execution of code. They allow you to specify a block of code to be executed if a certain condition is true, and an alternative block of code to be executed if the condition is false. This is useful for controlling the flow of your program based on different conditions.

$number = 10;

if ($number > 0) {
    echo "The number is positive.";
} else {
    echo "The number is not positive.";
}