maybe_serialize

Definition:
function maybe_serialize( $data ) {}

Serialize data, if needed.

Parameters

  • mixed $data: Data that might be serialized.

Return values

returns:A scalar data

Source code

function maybe_serialize( $data ) {

	if ( is_array( $data ) || is_object( $data ) )

		return serialize( $data );



	// Double serialization is required for backward compatibility.

	// See http://core.trac.wordpress.org/ticket/12930

	if ( is_serialized( $data ) )

		return serialize( $data );



	return $data;

}

2337

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: