On 18/02/2022 10:50, Rowan Tommins wrote:
Other than an optimised implementation, there's nothing particularly special about the ++ operator's handling of null, it behaves the same as any other arithmetic operator:

I would claim that the unary operators behave slightly different, if it were a case of cooerce to zero, the behaviour of null++ and null-- would be expected to be the same as operating on 0, but it's not.

null++ is allowed, but null-- returns null, and its value afterwards is null.

https://3v4l.org/Bnb2D

If anything, it's the fact that $a++ is NOT a special case that means it will be affected by this proposal.

It is intended to be affected by this proposal.

--
Mark Randall


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to