php

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";
    }
?>
Output
Equals to 10

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

Was this helpful?