PHP If Statement
The if statement in PHP is used to execute code only when a given condition evaluates to true.
Syntax
// Generic version of an if statementif (condition) { // Code to execute if the condition is true}Example
// Concrete example of an if statement$age = 18;
if ($age >= 18) { echo "You are eligible to vote.";}// Output: You are eligible to vote.