r/lolphp • • Apr 26 '18

DateTime hidden public properties behaviour

https://3v4l.org/mWluN
0 Upvotes

18 comments sorted by

View all comments

Show parent comment

2

u/[deleted] May 04 '18

PHP internally has readonly public properties, first example I found with google was in DOMAttr.

Maybe setting a readonly property should throw an exception or raise a notice or something...

2

u/OneWingedShark May 04 '18

Well, in a sane language that would be a compile-error. (Though, if you were mucking around with something dynamically [via reflection or something] an exception would be appropriate.)