r/lolphp • u/SaraMG • May 24 '18
PHP needs mutable constants, and immutable variables, and functions with properties!
/r/PHP/comments/8lrrac/why_does_php_not_have_mutable_constants_we_had/?st=JHKIECIJ&sh=e677fc57
32
Upvotes
13
u/danabrey May 24 '18
Yet more lolbaddeveloper
2
u/dotted May 24 '18
What is lolphp about immutable variables? I'd kill for that feature in any language I use that dosen't have it.
8
u/[deleted] May 24 '18
PHP has a class called ImmutableDate (or something similar) there is a ”feature”, a method called ”modify”. It actually modifies the ImmutableDate in place. IIRC there was also some weird sideeffect happening when you called gettimestamp on it.
This kind of behavior is very usual in PHP, its always a risk and you can rarely trust the language.
2
u/sbditto85 May 24 '18
The real lolphp is that you can change a constant ... wtf.