Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

Greater than (>)

Signal a limit overrun when the left value is greater than the right. A value exactly at the limit does not trigger the alarm.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

$left > $right

Signal a limit overrun when the left value is greater than the right. A value exactly at the limit does not trigger the alarm.

For numbers the result indicates whether a threshold condition holds. Test the value exactly at the boundary separately. Two numeric strings are compared numerically even when their lengths differ.

  • 9 > 8 → true
  • 8 > 8 → false
  • "12" > "9" → true

Examples

<?php
echo json_encode(9 > 8), PHP_EOL;
echo json_encode(8 > 8), PHP_EOL;
echo json_encode("12" > "9"), PHP_EOL;

Result

true
false
true

Sources