DEV Community

Discussion on: 5 tips in PHP 🐘

nfcristea profile image
Florin Cristea • Edited on

??= will also assign the value on first call, besides checking if it's set, meaning that the second time it gets reached it will have a value assigned and PropertyAccess::createPropertyAccessor() will no longer get called.
?? is just a classic isset check meaning the call to createProperyAccesor() is made every time it gets reached.
They're quite different although they look similar.