The function serialize() encodes the variable value passed into a special string, the function returns the encoded string.
Note: the function serialize() can be used with an array of data.
Syntax
Syntax: serialize( $var);
In which :
- $var is the variable to be converted.
For example
$var = array(
"laravel",
2017,
"css",
"blogdev.net"
);
$varSerialize = serialize($var);
echo "<pre>";
print_r($varSerialize);
echo "</pre>";
Result
a:4:{i:0;s:3:"laravel";i:1;i:2017;i:2;s:3:"css";i:3;s:12:"blogdev.net";}
Reference: php.net