What\'s the best way to determine whether or not a string is the result of the serialize()
function?
https://www.php.net/manual/en/function.serialize
If the $string is a serialized false
value, ie $string = 'b:0;'
SoN9ne's function returns false
, it's wrong
so the function would be
/**
* Check if a string is serialized
*
* @param string $string
*
* @return bool
*/
function is_serialized_string($string)
{
return ($string == 'b:0;' || @unserialize($string) !== false);
}