Horde_Serialize::unserialize PHP Метод

unserialize() публичный статический Метод

See the list of constants at the top of the file for the serializing techniques that can be used.
public static unserialize ( mixed $data, mixed $mode = self::BASIC, mixed $params = null ) : string
$data mixed The data to be unserialized.
$mode mixed The mode of unserialization. Can be either a single mode or array of modes. If array, will be unserialized in the order provided.
$params mixed Any additional parameters the unserialization method requires.
Результат string The unserialized data.
    public static function unserialize($data, $mode = self::BASIC, $params = null)
    {
        if (!is_array($mode)) {
            $mode = array($mode);
        }
        /* Parse through the list of unserializing modes. */
        foreach ($mode as $val) {
            /* Check to make sure the mode is supported. */
            if (!self::hasCapability($val)) {
                throw new Horde_Serialize_Exception('Unsupported unserialization type');
            }
            $data = self::_unserialize($data, $val, $params);
        }
        return $data;
    }

Usage Example

Пример #1
0
 /**
  * Retrieves the txt_datavalue or int_datavalue depending on context
  */
 public function getDataValue()
 {
     /* These field-specific handlers should better be delegated to field
      * definitions. */
     switch ($this->property->datatype) {
         case 'date':
         case 'datetime':
         case 'hourminutesecond':
         case 'monthdayyear':
         case 'monthyear':
         case 'time':
             if (is_int($this->txt_datavalue)) {
                 return new Horde_Date($this->txt_datavalue);
             }
             $dt = new Horde_Date();
             foreach (Horde_Serialize::unserialize($this->txt_datavalue, Horde_Serialize::BASIC) as $marker => $content) {
                 if (strlen($content)) {
                     $dt->{$marker} = $content;
                 }
             }
             return $dt;
         case 'image':
             return array('hash' => $this->txt_datavalue);
         default:
             return $this->txt_datavalue;
     }
 }
All Usage Examples Of Horde_Serialize::unserialize