PHP copies arrays by default. Python and JavaScript share references by default. If you switch between these languages and don't switch your mental model with them, you'll spend hours debugging an array that "shouldn't" have changed. Here's the breakdown, with code, for all three.

The Bug Nobody Warns You About

You pass an array into a function, mutate it, then check the original — and it's changed too. Or the reverse: you expected a shared reference and got a clean copy instead.

It's not really one bug. It's three different language models wearing the same disguise.

PHP arrays are value types (copied by default). Python lists are reference types (shared by default). JavaScript arrays are objects passed by reference — with a const twist that catches even seniors off guard.