Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

Difference (-)

Subtract the dispatched quantity from the stock level.

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

Syntax

$value - $operand

Subtract the dispatched quantity from the stock level. A negative difference means the dispatch exceeds the available stock.

With integer operands a result within the integer range stays an integer. Overflow can produce a float and lose precision.

Evaluation

  • 16 - 5 → 11
  • 4 - 9 → -5
  • 3 - 0 → 3

Examples

<?php
echo json_encode(16 - 5), PHP_EOL;

echo json_encode(4 - 9), PHP_EOL;

echo json_encode(3 - 0), PHP_EOL;

Result

11
-5
3

Sources