PHP serialize() Function

❮ PHP Variable Handling Reference

Example

Convert a storable representation of a value:

<?php
$data = serialize(array("Red", "Green", "Blue"));
echo $data;
?>
Try it Yourself »

Definition and Usage

The serialize() function converts a storable representation of a value.

To serialize data means to convert a value to a sequence of bits, so that it can be stored in a file, a memory buffer, or transmitted across a network.


Syntax

serialize(value);

Parameter Values

Parameter Description
value Required. Specifies the value to be serialized

Technical Details

Return Value: A string that contains a byte-stream representation of value. The string can be stored anywhere
Return Type: String
PHP Version: 4.0+

❮ PHP Variable Handling Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.