class Car {
function __construct() {
// echo 'car con';
}
function setInfo($car_arr) {
foreach ($car_arr as $key => $value) {
$this->{$key} = $value;
}
}
}
i try to access like bellow
$car1 = new Car();
$car1->setInfo('make', 'Toyota')->setInfo('model', 'scp10');
that gave to me bellow error
Call to a member function setInfo() on a non-object
how can i change setInfo() method call $car1->setInfo('make', 'Toyota')->setInfo('model', 'scp10');
after that car class set $make = 'Toyota', like that
how can i print this object like bellow
make = Toyota
model = scp10