I have an array that looks something like this
array( 'cars' => 10, 'trucks' => 20, 'computers' => 50 );
Now I want to store the field and value pairs in a database field. I also want to be able to retrieve it so the array will be in the same form as it was.
That’s what
serialize()is forSlightly More Elaborated
The
serialize()function gets (almost) any type of value as an arguments, and outputs a storable string.When you want to retrieve the value from the database, you use
unserialize()