Function Reference/maybe serialize
Description
Serialize data, if needed.
Usage
<?php maybe_serialize( $data ); ?>
Parameters
- $data
- (mixed) (required) Data that might be serialized.
- Default: None
Return Values
- (mixed)
- A scalar data
Examples
Notes
- Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.
- Confusingly, strings that contain already serialized values are serialized again, resulting in a nested serialization. Other strings are unmodified.
Change Log
Since: 2.0.5
Source File
maybe_serialize() is located in wp-includes/functions.php.
Related