filename); foreach ($data as $k => $v) { $this->set($k, $v); } $this->loaded = true; } public function save() { $str = []; $str []= 'data as $k => $v) { $str []= "'" . $k . "' => " . $v; } $str []= '];'; $str []= ''; file_put_contents($this->filename, implode(PHP_EOL, $str)); } }