note 46821 deleted from function.var-export by tomsommer

From: Date: Sun, 24 Oct 2004 17:06:37 +0000
Subject: note 46821 deleted from function.var-export by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79045@lists.php.net to get a copy of this message
Note Submitter: voyager at noo dot ru ---- Here is another way to save and restore variables: <?php function var_to_file($var, $file) { $exported = var_export($var, true); $fp = fopen($file, "w"); fwrite($fp,$exported); fclose($fp); } function var_from_file($file) { if(!file_exists($file)) { return; } $content=join("",file($file)); if(!$content) { return; } eval("\$temp = $content; ?>"); return $temp; } ?>

« previous php.notes (#79045) next »