I didn't even realize that there was a difference between preincrementation
and postincrementation when used in array access.

I guess this is because my default preference is preincrementation and also
that I probably don't use a lot of incrementation while accessing array
data.

I held a false belief that the different syntaxes only mattered when
echoing.

$x = 0;
$array1[1] = 43;
$array1[++$x] ??= 42;
var_dump($x, $array1);

echo "\n---\n";

$y = 0;
$array2[0] = 43;
$array2[$y++] ??= 42;
var_dump($y, $array2);

Thanks Ilija

mickmackusa

Reply via email to