In a previous post, I mentioned that arrays in PHP are passed by value.ce,
For some reason, there are mixed information about if PHP objects are passed by reference, so I decided to write a short block of code to find out. The result is, as PHP 5, object are passed by reference.
The following is a short PHP file for the purpose of testing.
The output of this PHP file from the web server follows:
Before: a = abc, b = cde After: a = aaa, b = bbb
This shows, PHP passes objects by reference.