CKTIS / PHP
Quotient with assignment (/=)
Divide the current batch size by a factor and replace it with the quotient.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
$value /= $operandDivide the current batch size by a factor and replace it with the quotient. An integer can become fractional after the update.
A zero divisor raises DivisionByZeroError. Exact division of two integers yields an integer, while a fractional result has type float. Overflow is an exception. Evaluating PHP_INT_MIN / -1 produces a float.
Evaluation
$value = 16; $value /= 4;→4$value = 9; $value /= 2;→4.5$value = (-3); $value /= 2;→-1.5
Examples
<?php
$value = 16;
$value /= 4;
echo json_encode($value), PHP_EOL;
$value = 9;
$value /= 2;
echo json_encode($value), PHP_EOL;
$value = (-3);
$value /= 2;
echo json_encode($value), PHP_EOL;
Result
4 4.5 -1.5