Without seeing the source, the results will be quite meaningless.

The source code for this example is here.

Curiously, the PHP source syntax hilighter stops displaying the code at an arbitrary point (I do so love PHP) so you can see the whole source, sans syntax hilighting, here.

Anyway. On to the results...


Here's an instance of myClass:
object(myClass)#1 (1) { ["member"]=> string(7) "default" }

Here's the instance, after passing it to myBadFunction():
object(myClass)#1 (1) { ["member"]=> string(3) "foo" }

It didn't change! That's because all variables are passed by value by default!

Include an '&' in a parameter declaration to indicate pass by reference.

Here's the instance, after passing it to myGoodFunction().
object(myClass)#1 (1) { ["member"]=> string(3) "foo" }

Here's an example of a function that returns a reference:

The result is:
object(myClass)#1 (1) { ["member"]=> string(4) "glue" }

The result should be a reference to the original object. If we change it, the original object should be modified:

Original object is now:
object(myClass)#1 (1) { ["member"]=> string(6) "slough" }