Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

Product (*)

Multiply a unit price by a quantity.

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

Syntax

$value * $operand

Multiply a unit price by a quantity. A zero quantity produces a zero line total for any finite price.

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

Evaluation

  • 16 * 5 → 80
  • (-4) * 3 → -12
  • 9 * 0 → 0

Examples

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

echo json_encode((-4) * 3), PHP_EOL;

echo json_encode(9 * 0), PHP_EOL;

Result

80
-12
0

Sources