Пример #1
0
/**
 * A modified version of unserialize().
 * @param string $var Serialized (using serial()) variable
 * @param bool $recur This argument is only used internally for recursive calls
 * @return unknown_type
 */
function unserial($var = FALSE, $recur = FALSE)
{
    if ($recur) {
        foreach ($var as $k => $v) {
            if (is_array($v)) {
                $var[$k] = unserial($v, 1);
            } else {
                $var[$k] = base64_decode($v);
            }
        }
        return $var;
    } else {
        return unserial(unserialize($var), 1);
    }
}
Пример #2
0
 /**
  * Decode an array or object encoded with arrayEncode
  * @see arrayEncode()
  * @param string $val Encoded array
  * @return array|object
  */
 function arrayDecode($val)
 {
     return unserial(base64_decode(substr($val, 10)));
 }