Join Nostr
2026-07-11 11:46:32 UTC

ignace nyamagana butera on Nostr: #PHP I've notice that I barely use __toString nowadays. I came to realise that there ...

#PHP I've notice that I barely use __toString nowadays. I came to realise that there is no one true single string representation for anything. So __toString is a bad micro/early optimisation that should be avoided. It is conceptually a bad idea. I prefer toWhateverRepresentationString. it might be a bit longer to type but it won't bite you in six months.
PS: I have the same thoughts for toArray.