Serialize
serialize() Returns a string containing a byte-stream representation of any variable.
Is used to store the variables in the same format
without loosing their data type and structure
for example we have an array of varying number of keys
which we want to store and use it in another script
Its very tedious to store it in database and retrieve .
In such case we can serialize it and store the resulting
string and get back the value and unserialize it get
the array as it is in original form
‘hai’,'b’=>’how you’,'three’);
$st = serialize($arr);
$val = unserialize($st);
var_dump($val);
?>
Result is:
array(3) { [”a”]=> string(3) “hai” [”b”]=> string(8) “how are you” [0]=> string(14) “three” }
