derickr / vld

BSD 2-Clause "Simplified" License
464 stars 87 forks source link

Wrong operator values #78

Closed foobar13372 closed 2 years ago

foobar13372 commented 2 years ago

https://3v4l.org/NMrv2/vld

$i = 1;
echo $i++ + ++$i;

PHP correctly returns 4 because it adds 1 + 3. VLD however says for the operands ~2, ~3 - which is clearly wrong (but the result ~4 is correct).

derickr commented 2 years ago

VLD doesn't show the values, but the (internal) variable number that the PHP engine uses. Change your initial value to something else (say 42) and the VLD output will be the same.