I have a class:
class Foo {
// Accept an assoc array and appends its indexes to the object as property
public function extend($values){
forea
Just plain, bad design.
What's the purpose of adding a private [!] field at runtime? Existent methods can't rely on such added fields, and you'd be messing with the object functionality.
If you want your object to behave like an hashmap [i.e. you can just call $obj -> newField = $newValue], consider using magic __get and __set methods.