WordPress at a glance

maybe_unserialize() WP 1.0

Unserialize value only if it was serialized.

✈ 1 time = 0.000047s = very fast | 50000 times = 1.21s = fast PHP 7.1.2, WP 4.7.4

No Hooks.

Return

Mixed. Unserialized data can be any type.

Usage

maybe_unserialize( $original );
$original(string) (required)
Maybe unserialized original, if is needed.

Code of maybe_unserialize: wp-includes/functions.php VER 4.9.8

<?php
function maybe_unserialize( $original ) {
	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
		return @unserialize( $original );
	return $original;
}

Related Functions

From tag: serialize

More from category: Helper Functions

No comments
    Hello, !     Log In . Register