Over a million developers have joined DZone.

Maybe UnSerialize

·
Checks to see if a string is actually the serialized version of an array. If it is, we return an unserialized version. If not, return the original string. This way, we can just call our function on stored DB values and not worry about checking the results.

This was snagged from the Wordpress 2.0 source. Yayyy for Open Source!


	function maybe_unserialize ( $original ) {
		if ( false !== $gm = @ unserialize($original) )
			return $gm;
		else
			return $original;
	}
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}