I have this class
class MyClass{
private $id;
private $name;
public function __construct ($id, $name){
$this->name = $name;
}
}
$ob1 = new MyClass(1, 'earth');
$ob2 = new MyClass(2, 'sky');
$ob3 = new MyClass(3, 'ocean');
I want that my objects $ob1, $ob2 and $ob3 have a different attribute $id. For example when i make this :
$ob4 = new MyClass(3, 'wood');
The code denies me to create the object
Thanks