Search code snippets, questions, articles...

Conditions or if else statement in PHP

<?php
    $x = 10;
    if ($x > 10) {
        echo "Greater than 10";
    } else if ($x < 10) {
        echo "Less than 10";
    } else {
        echo "Equals to 10";
    }
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.
Output
Equals to 10

Conditions in PHP can be implemented using if else keywords and by writing conditions with them.

Was this helpful?
0 Comments