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); }
Author:
Jonas John
License:
Public Domain
Language:
PHP
Created:
04/03/2006
Updated:
04/03/2006
Tags:
array functions, serialize
save_array_dump('test.txt', array(1,2,3));
Sorry folks, comments have been deactivated for now due to the large amount of spam.
Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!
Older comments:
$el_array = load_array_dump($el_file);
echo "<pre>El array :n";
print_r($el_array);