Dynamic objects a-la Javascript in PHP with inheritance