Re: storing arrays

From: Date: Sun, 17 Feb 2002 18:28:11 +0000
Subject: Re: storing arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85109@lists.php.net to get a copy of this message
"Clark" <wiseguy316@netzero.com> wrote in message news:20020217022913.92497.qmail@pb1.pair.com... > Two questions: > > 1) Is it possible to write an array to a file? What about using WDDX, an open XML-format for interchanging data (see http://www.openwddx.org/) ? You then will be able to do this: <?php $c = array("blue", "orange", "violet"); $f = fopen("MyFile.wddx", "w"); fwrite($f, wddx_serialize_vars("c")); fclose($f); ?> To unserialize: <?php $fname = "MyFile.wddx"; $f = fopen($fname, "rb"); $packet = fread($f, filesize($fname)); $c = wddx_deserialize($packet); fclose($f); ?> > 2) Is it possible to specify the name of the key to each item of an array > when you get the array using file(). Yep, you'll get the same array back... -- Christian Blichmann _____________________________________________ don't hesitate - email me with your thoughts: e-mail: feedback.nospam@blichmann.de - please remove the ".nospam" from address. _____________________________________________ do you want to know more? web: http://www.blichmann.de

« previous php.general (#85109) next »