".$data); } else { $handle = fopen($textfile, "w"); fclose($handle); file_put_contents($textfile, " ".$data); } } /** * Saves by adding it to the old. Not very useful * @param any $data Anything you want to save * @param string $textfile The name of the file you want to save your data */ function save_add($data, $textfile){ $old = file_get_contents($textfile); $data = serialize($data); if(file_exists($textfile)){ file_put_contents($textfile, $old.$data); } else { $handle = fopen($textfile, "w"); fclose($handle); file_put_contents($textfile, $old.$data); } } /** * Gets the data from a file * @param string $textfile The name of the file you want to save your data * @returns any The data from the file */ function get($textfile){ $content = file_get_contents($textfile); $content = str_replace(" ", "", $content); return unserialize($content); } } ?>