A #PHP global constant redefinition is a simple warning.
A #PHP class constant redefinition is a full Fatal Error.
I am so used to the Fatal error, that I expected the global constant to behave the same. Shouldn't they?
[#]phptip #phptrick
https://php-tips.readthedocs.io/en/latest/tips/constant_redefinition.html
=> More informations about this toot | More toots from dseguy@phpc.social
@dseguy I suspect it can be problematic if packages define global constance. (I don't know if there are packages who are doing that)
=> More informations about this toot | More toots from tvbeek@phpc.social
@tvbeek A quick search across 3100+ OSS source codes shows 902 (29%) of them using define(): even more of them use const, although for class constant too.
Then, 1370 uses defined() (44%): again, class and global, so actual might be lower.
So, that is roughly one out of 3 of us.
If it is not you, or me, who can it be? names! names! 😂
=> More informations about this toot | More toots from dseguy@phpc.social
text/gemini
This content has been proxied by September (ba2dc).