Utils.php
761 Bytes
<?php
/**
* Created by PhpStorm.
* User: Ziy
* Date: 14/9/8
* Time: 下午4:38
*/
class YHMIm_Utils
{
static function getTalkID(array $talkData)
{
asort($talkData);
return md5(implode('.', $talkData));
}
function arrayToObject($array)
{
if (!is_array($array)) {
return $array;
}
$object = new stdClass();
if (is_array($array) && count($array) > 0) {
foreach ($array as $name => $value) {
$name = strtolower(trim($name));
if (!empty($name)) {
$object->$name = $this->arrayToObject($value);
}
}
return $object;
} else {
return FALSE;
}
}
}