Re: serialize/deserialize data

From: Date: Tue, 13 Feb 2001 03:14:41 +0000
Subject: Re: serialize/deserialize data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39317@lists.php.net to get a copy of this message
"Brian V Bonini" <brian@gfx.cncdsl.com> wrote: > What exactly does > serialize/deserialize data > mean? See the manual at http://www.php.net/manual/en/function.serialize.php. Serializing is a way of storing values so that they retain their type and structure. Session variables are stored in this way. Here's a serialized set of session variables from an intranet application I wrote: employee_id|s:4:"7204";logged_in|i:1;name_l|s:7:"Edmonds";name_f|s:5:"Larry" ;component_id|a:5:{i:0;s:4:"1001";i:1;s:4:"1002";i:2;s:4:"1003";i:3;s:4:"100 4";i:4;s:7:"1002101";} unserialize( $var_name ) will pull transform the values back into their normal state. If you want to pass form data from page to page (arrays in particular), store an array in a single field of a database or store values and retain the fact that they're an integers, strings, etc. serialize is a good way to accomplish this. I hope that helped clarify serialize a little. If not, just play with it a little to understand it. -- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/

« previous php.general (#39317) next »