I always disliked the way PHP handles Objects. There is no way to assign a type to properties. Validators have to be glued against the fields externally and you can't just generate a Object-Description (like WSDL) from a object either.
Usually you have DataObjects like:
/* a plain-old-php-object */
class Employee {
var $employee_id;
var $name;
var $surname;
var $since;
}
and as a human you immediatly how to use it:
$e = new Employee(); $e->name = "Jan"; $e->surname = "Kneschke"; $e->employeenr = 123; $e->since = mktime(0, 0, 0, 1, 1, 2005);
But you can also have a bad day and write something like:
$e->unknown = "value"; $e->since = "Monday";
The property unknown gets created automaticly in the
object and since gets a invalid value. If you take a
look at ActiveRecord in Rails you see how proper
types …