Understanding Copies & References in PHP
The inner workings of PHP aren’t something most WordPress developers need to worry about too much. Especially if you focus on the front end and are a master of flex-box (I’m neither) you probably can safely never understand the subtleties of copies and passing-by-reference in PHP (or any other programming language). But as you make more complex plugins, this stuff starts to get kind of important. Important enough that you should read this great article by our friend Josh Pollock and get at least a little familiar with it.
The basic thing you need to get from it is that pass-by-reference, which is uncommon in scalar PHP happens a lot with objects. And when it does, you’ll hit some odd behavior. Josh’s post does a good job sussing out some of these subtleties, but I think it’s far important to learn the basic conceptual lesson he’s giving than memorizing it’s specific nuances.