Concept Flow - If statement execution flow
Start
Evaluate condition
Execute if-block
Continue
Skip if-block
Continue
The program checks the condition. If true, it runs the code inside the if-block. If false, it skips it and continues.
<?php $age = 20; if ($age >= 18) { echo "Adult"; } ?>
| Step | Condition ($age >= 18) | Result | Branch Taken | Output |
|---|---|---|---|---|
| 1 | 20 >= 18 | True | Execute if-block | Adult |
| 2 | End of if statement | - | Continue | - |
| Variable | Start | After Step 1 | Final |
|---|---|---|---|
| $age | 20 | 20 | 20 |
if (condition) {
// code runs if condition is true
}
Checks condition once.
Runs block only if true.
Skips block if false.
Then continues program.