PHP Tips

Adding a Property to an Object
function add_a_property($object, $property_name, $property_value) { $temporary_array = (array) $object; $temporary_array[$property_name] = $property_value; return (object) $temporary_array; }
 * 1) Returns a clone of the original object, with the added property