I just stumbled across a super useful blog post on the internals for PHP’s memory management; and explains the management process quite well.

It’s an old article (from 2008), and I’m not too sure how much the memory management has changed, but it still provides some good principles. Think twice before passing that variable by reference!

You can read the article at http://porteightyeight.com/2008/03/18/the-truth-about-php-variables/.