if greater than and less than php code example

Example 1: php if less than number

<?php
if ($a > $b)
  echo "a is bigger than b";
?>

Example 2: operators in php

if (condition)
   code to be executed if condition is true;
else
   code to be executed if condition is false;

Example 3: php ?:

// Example usage for: Ternary Operator
$action = $_POST['action'] ?: 'default';

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
    $action = 'default';
} else {
    $action = $_POST['action'];
}

Tags:

Php Example