Does PHP pass objects by value or by reference by default, and how does this impact memory usage?

Last updated 15 June 2026

  • PHP passes objects by handle (a small identifier), so both variables point to the same instance and mutations are shared.

  • It is technically pass-by-value of the handle: reassigning the parameter to a new object does not change the caller's variable, unlike a true & reference.

  • Passing large objects is cheap since no deep copy happens. Use clone for an independent (shallow) copy.

  • https://www.reddit.com/r/PHP/comments/1934a25/do_you_use_reference_parameters/
All PHP interview questions