serialize
Generate a representation of a storable value
The serialize()
function generates a storeable representation of the value.
This helps store or pass the value of PHP without losing its type and structure.
To convert the serialized string back to the value of PHP, use unserialize()
.
Convert values to storable representations:
<?php $data = serialize ( array ( "Red" , "Green" , "Blue" ) ) ; echo $data ; ?>
Try it yourself
serialize ( value ) ;
parameter | describe |
---|---|
value | Required. Specifies the value to be serialized. |