Directly changing object values. string(10) "Original a" string(10) "Original b" string(10) "Original c" object(C)#1 (5) { ["a"]=> string(9) "changed.a" ["b"]=> string(9) "changed.b" ["c"]=> string(9) "changed.c" ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" } Modifying the foreach $value. object(C)#2 (5) { ["a"]=> string(10) "Original a" ["b"]=> string(10) "Original b" ["c"]=> string(10) "Original c" ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" } Modifying the foreach &$value. object(C)#1 (5) { ["a"]=> string(9) "changed.a" ["b"]=> string(9) "changed.b" ["c"]=> &string(9) "changed.c" ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" } Adding properties to an an object. string(10) "Original a" string(10) "Original b" string(10) "Original c" string(16) "Added property 0" string(16) "Added property 1" string(16) "Added property 2" string(16) "Added property 3" string(16) "Added property 4" string(16) "Added property 5" string(16) "Added property 6" string(16) "Added property 7" Loop detected object(C)#2 (17) { ["a"]=> string(10) "Original a" ["b"]=> string(10) "Original b" ["c"]=> string(10) "Original c" ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" ["new0"]=> string(16) "Added property 0" ["new1"]=> string(16) "Added property 1" ["new2"]=> string(16) "Added property 2" ["new3"]=> string(16) "Added property 3" ["new4"]=> string(16) "Added property 4" ["new5"]=> string(16) "Added property 5" ["new6"]=> string(16) "Added property 6" ["new7"]=> string(16) "Added property 7" ["new8"]=> string(16) "Added property 8" ["new9"]=> string(16) "Added property 9" ["new10"]=> string(17) "Added property 10" ["new11"]=> string(17) "Added property 11" } Adding properties to an an object, using &$value. string(10) "Original a" string(10) "Original b" string(10) "Original c" string(16) "Added property 0" string(16) "Added property 1" string(16) "Added property 2" string(16) "Added property 3" string(16) "Added property 4" string(16) "Added property 5" string(16) "Added property 6" string(16) "Added property 7" Loop detected object(C)#1 (17) { ["a"]=> string(10) "Original a" ["b"]=> string(10) "Original b" ["c"]=> string(10) "Original c" ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" ["new0"]=> string(16) "Added property 0" ["new1"]=> string(16) "Added property 1" ["new2"]=> string(16) "Added property 2" ["new3"]=> string(16) "Added property 3" ["new4"]=> string(16) "Added property 4" ["new5"]=> string(16) "Added property 5" ["new6"]=> string(16) "Added property 6" ["new7"]=> string(16) "Added property 7" ["new8"]=> &string(16) "Added property 8" ["new9"]=> string(16) "Added property 9" ["new10"]=> string(17) "Added property 10" ["new11"]=> string(17) "Added property 11" } Removing properties from an object. string(10) "Original a" object(C)#2 (2) { ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" } Removing properties from an object, using &$value. string(10) "Original a" object(C)#1 (2) { ["d":protected]=> string(10) "Original d" ["e":"C":private]=> string(10) "Original e" }