Skip to main content

safe_unserialize()

public static function safe_unserialize( $string, $expected, $default=false )

Unserializes a string while suppressing errors, checks if the result is of the expected type.

Since: 2.6.2.1

Source: common.php:8008

Parameters

NameTypeDefaultDescription
$stringstringThe string to be unserialized.
$expectedstringThe expected type after unserialization.
$defaultboolfalseThe default value to return if unserialization failed.

Returns

  • false | mixed