The plain old {Insert Language Here} Object is a simple approach that says you don't always need to use an extensive class to store data or execute logic.
In PHP, you can create a βsimpleβ object by creating an instance of stdClass.
$object = new stdClass;
$object->value = "Hello World";
echo $object->value;
Compared to a larger object that implements the interface:
interface HelloWorldInterface {
public function getValue();
public function setValue($value);
}
class HelloWorld implements HelloWorldInterface {
protected $value;
public function getValue()
{
return $this-value;
}
public function setValue($value) {
$this->value = $value;
}
}
$object = new HelloWorld;
$object->setValue("Hello World");
echo $object->getValue();
stdClass, , , , .