Load and save a array dump
Loads and saves a compressed dump of an array
function load_array_dump($filename) {
$fp = fopen($filename,"r");
$content = fread($fp,filesize($filename));
fclose($fp);
eval('$array='.gzuncompress(stripslashes($content)).';');
return($array);
}
function save_array_dump($filename, $array) {
$dump = addslashes(gzcompress(var_export($array,true),9));
$fp = fopen($filename, "wb+");
fwrite($fp, $dump);
fclose($fp);
}
//Example
save_array_dump('test.txt', array(1,2,3));
Url: http://www.jonasjohn.de/snippets/php/load-and-save-a-array-dump.htm
Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013