'; file_put_contents($name . '.xml', $dbContent); } } public function write($what, $content){ // name from __construct should be available here echo 'You wrote row '.$what.' with '.$content.' to database '.$name.''; } } $taste = new createDatabase('test'); $taste->write('name','Jonathan'); ?>