I also wonder what the purpose of wrapping native PHP array mutation in an object is and what overhead that introduces.
I'm with you on being kind in code reviews but one of the canonical examples of sticky bad PHP code is the addslashes top answer on SO for preventing SQL injection. It stayed there for years/decades and hundreds if not thousands of junior devs copied and pasted it.
So there's some risk when we share code that Google can index and possibly elevate.
I think consulting an algorithms book first would give a more formal example that you could work from.
> purpose of wrapping native PHP array mutation in an object is and what overhead that introduces.
The purpose is to illustrate what we are doing and setting the stage for later implementations. The overhead is practically unmeasurable unless we are filling the object table with these things (we are not).
Property lookup and function calls are pretty darn fast in PHP, especially with JIT enabled.
I'm with you on being kind in code reviews but one of the canonical examples of sticky bad PHP code is the addslashes top answer on SO for preventing SQL injection. It stayed there for years/decades and hundreds if not thousands of junior devs copied and pasted it.
So there's some risk when we share code that Google can index and possibly elevate.
I think consulting an algorithms book first would give a more formal example that you could work from.