Home > Backend Development > PHP Tutorial > Practical instructions for PHP serialize and unserialize_PHP tutorial

Practical instructions for PHP serialize and unserialize_PHP tutorial

WBOY
Release: 2016-07-20 11:08:59
Original
929 people have browsed it

serialize — generates a storable representation of a value
unserialize — creates a php tutorial value from a stored representation

Want to turn a serialized string back into a php value, You can use unserialize(). serialize() can handle any type except resource. You can even serialize() arrays that contain references to themselves. References in the array/object you are serializing() will also be stored.

*/
serialize

//store data:
$array = explode('rn', $string);
$serialized = serialize($array) ;

//restore data:
$array = unserialize($serialized);
$text = implode('rn', $array);


unserialize
function restorepost() {
if (isset($_post[savepost])) {
$_post = unserialize(strips tutorial lashes(htmlspecialchars_decode($_post[savepost]))));
}
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444826.htmlTechArticleserialize generates a representation of a storable value unserialize creates a value from a stored representation php tutorial want to To change the serialized string back to a PHP value, you can use unserializ...
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