Thanks, I didn't know about spl_object_id() (it's actually more straightforward than using var_dump() as I suggested), I added it below the var_dump example.
The "Objects and references" page from the doc is what prompted me to write this article because I found it a little obtuse for a junior dev, and it didn't provide examples of situations where the "objects are passed by reference" simplification doesn't cut it.
And thanks for the "counted references" article, I just fell into a new rabbit hole :-p
**We can disagree and still be friends.**
I build bridges and tools for others to use.
I maintain and improve a lot of legacy code, monoliths, services.
I spend my free dev-time on FOSS packages.
It's a bit complex, but simply by understanding the concept of counted references, one can get a hint on how garbage collectors work and also understand the meaning behind WeakMap and WeakReference.
The concept is also used in ther languages that use garbage collection.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks, I didn't know about
spl_object_id()(it's actually more straightforward than usingvar_dump()as I suggested), I added it below the var_dump example.The "Objects and references" page from the doc is what prompted me to write this article because I found it a little obtuse for a junior dev, and it didn't provide examples of situations where the "objects are passed by reference" simplification doesn't cut it.
And thanks for the "counted references" article, I just fell into a new rabbit hole :-p
It's a bit complex, but simply by understanding the concept of counted references, one can get a hint on how garbage collectors work and also understand the meaning behind WeakMap and WeakReference.
The concept is also used in ther languages that use garbage collection.