maybe_unserialize( string $data ): mixed

Unserializes data only if it was serialized.

Parameters

$datastringrequired
Data that might be unserialized.

Return

mixed Unserialized data can be any type.

More Information

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.

Source

 *
 * @since 2.0.0
 *
 * @param string $data Data that might be unserialized.
 * @return mixed Unserialized data can be any type.
 */
function maybe_unserialize( $data ) {

Changelog

VersionDescription
2.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.