Zum Inhalt der Seite gehen


Using #PHP arrays as pseudo-objects is almost never the right answer. They're less self-documenting, slower, worse on memory, and more bug prone.

peakd.com/php/@crell/php-use-a…

#php
Als Antwort auf Alerta! Alerta!

@heiglandreas yes, ArrayObjects are massively underrated, combing the best of both arrays and objects. True generics.
Dieser Beitrag wurde bearbeitet. (1 Monat her)
Als Antwort auf Dan Leech

@dantleech Yeah... and no
They are also.combining the worst of both sides.

A generic object that can contain anything without knowing from the outside....

One *can* use it in awesome ways. But sonfar.most of the time it was used the same way as an associative array. So the only advantage over a real array is that it is an object. That's it. No added type-safety, no predictability, nothing....

/cc @Crell

Als Antwort auf Alerta! Alerta!

@heiglandreas sorry - i was attempting to be funny. i actually think they are terrible and should never be used under any circumstance that I can think of 😁
Dieser Beitrag wurde bearbeitet. (1 Monat her)
Als Antwort auf Dan Leech

@dantleech 🤣 Sorry for not getting the joke! Well, I kinda got it but it was just too close to.reality...

I sense a need to calibrate my sarkasm sensors.... 🙈

/cc @Crell

Als Antwort auf Larry Garfield

I'm working on designing the architecture for a new thing and initially, I used an associative array to store two additional values because I thought they wouldn't need their own class. Yesterday, I changed my mind and created a separate value object for these properties, because I really don't want to have to remember the associative array keys, IDE autocomplete makes life easier...
Dieser Beitrag wurde bearbeitet. (1 Monat her)

Diese Webseite verwendet Cookies. Durch die weitere Benutzung der Webseite stimmst du dieser Verwendung zu. https://inne.city/tos