name = $name; if(!file_exists($name . '.xml')){ touch($name . '.xml'); $dbContent = ''; 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 '.$this->name.''; } } $taste = new createDatabase('test'); $taste->write('name','Jonathan'); ?>