CKTIS / PHP
Increment (++)
Add one to an integer counter.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
++$value
$value++Add one to an integer counter. Prefix notation yields the incremented value immediately, while postfix yields the old value before the same change takes effect. A loop can therefore consume the current index and advance it in a single operation. Avoid relying on the evaluation order of multiple increments in one expression. In PHP 8.4 a numeric string becomes a number, null becomes integer 1, and a boolean is unchanged with E_WARNING. The distinct ASCII alphanumeric increment changes "Z" to "AA". This usage has been soft-deprecated since PHP 8.3 in favor of str_increment.
++$value
$value++
[4,6,6]
Examples
<?php
$next = 4;
$allocated = $next++;
$following = ++$next;
echo json_encode([$allocated,$following,$next]);
Result
[4,6,6]