Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

Less than or equal to (<=)

Accept a load whose weight does not exceed capacity. A load exactly at capacity satisfies the condition.

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

Syntax

$left <= $right

Accept a load whose weight does not exceed capacity. A load exactly at capacity satisfies the condition.

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.

  • 7 <= 8 → true
  • 8 <= 8 → true
  • 9 <= 8 → false

Examples

<?php
echo json_encode(7 <= 8), PHP_EOL;
echo json_encode(8 <= 8), PHP_EOL;
echo json_encode(9 <= 8), PHP_EOL;

Result

true
true
false

Sources