Home > Backend Development > PHP Tutorial > Serialization of arrays

Serialization of arrays

WBOY
Release: 2016-08-08 09:26:09
Original
1998 people have browsed it

Array serialization is to convert the array data into a string for transmission and database storage. The corresponding deserialization is to convert the string data into array data.
The function corresponding to serialization is serialize(), and the function corresponding to deserialization is: unserialize().
The data after serialization of the former can be stored in a certain field of the database, and then processed through deserialization when used.
Here is a simple example:
$arr = array('Zhang San','Li Si');
$str = serialize($arr);
echo $str."
";
$new_arr = unserialize($str);
print_r($new_arr);

?>

Run result:


The above has introduced the serialization of arrays, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template