maybe_serialize

Serialize data, if needed.

Description

maybe_serialize( (mixed) $data ); 

Parameters (1)

0. $data (mixed)
Data that might be serialized.

Usage

  1. if ( !function_exists( 'maybe_serialize' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php'; 
  3.  
  4. // Data that might be serialized. 
  5. $data = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = maybe_serialize($data); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/backpress/functions.core.php  
  1. function maybe_serialize( $data ) { 
  2. if ( is_array( $data ) || is_object( $data ) ) 
  3. return serialize( $data ); 
  4.  
  5. if ( is_serialized( $data ) ) 
  6. return serialize( $data ); 
  7.  
  8. return $data;