Use case are value objects
$a = new stdClass;
$a->something = 12;
$a->somethingElse = 'Hello World';
myFunction ($a);
This allows you to create some objects that simply carry structured data (something like structsin other languages), without having to define a class for it.
Another point is that since PHP is weakly typed anyway, there is no reason to ban it. If you need something stronger, overweite__set()
public function __set ($propertyName, $value) {
throw new Exception("Undefined Property $propertyName");
}
source
share