Php - How to serialize unserialize an array, Php - serialize unserialize an array

How to serialize unserialize an array

how to serialize and unserialize an array in php?

As arrays are complex data types, you cannot see their contents directly. If you try printing out the value of an array, you will see PHP just outputs \'Array\', which means that passing the value of an array through a link requires a lot of work.

Serialize() converts an array, given as its only parameter, into a normal string that you can save in a file, pass in a URL, etc.

Unserialize() is the opposite of serialize() - it takes a serialize()d string and converts it back to an array.

An Example to serialize and unserialize:


===========================================

"; print $strenc . " "; ?>
Above is an simple example to provide serialize and unserialize an array

OutPut:
a:3:{s:1:\"a\";s:3:\"Foo\";s:1:\"b\";s:3:\"Bar\";s:1:\"c\";s:3:\"Baz\";}

============================================================

a%3A3%3A%7Bs%3A1%3A%22a%22%3Bs%3A3%3A%22Foo.........

The topic on Php - How to serialize unserialize an array is posted by - Leon

Hope you have enjoyed, Php - How to serialize unserialize an arrayThanks for your time

Tech Bluff