PHP's serialize () function and unserialize () function
Context: Serialize () returns a string that contains a byte stream representing value that can be stored anywhere. This facilitates the storage or delivery of PHP values without losing their type and structure. A useful place to put data in a database or in a file. This article mainly and you introduce PHP serialize () function and unserialize () function of the relevant information, the need for friends can refer to, hope to help everyone.
Serialize () handles all types outside of a resource type, and can also serialize an object
<?php $array = Array (); $array [' keys '] = ' www '; $array [' Values ']= ' 11111 '; $a = serialize ($array); echo $a; Unset ($array); $a = unserialize ($a); Print_r ($a);?>
Output
A:2:{s:4: "Keys"; s:3: "www"; s:6: "Values"; s:5: "11111";} Array ([keys] = www [values] = 11111)
The same is true for class operations.