English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
serialize() function is used to serialize an object or array and return a string.
serialize() After serializing an object with the function, it can be easily passed to other places that need it, and its type and structure will not change.
If you want to convert a serialized string back to PHP's value, you can use unserialize().
PHP version requirement: PHP 4, PHP 5, PHP 7
string serialize ( mixed $value )
Parameter description:
Returns a string.
<?php $sites = array('Google', 'w3codebox', 'Facebook'); $serialized_data = serialize($sites); echo $serialized_data . PHP_EOL; ?>
The output result is:
a:3:{i:0;s:6:"Google";i:1;s:6:"w3codebox";i:2;s:8:"Facebook";}