[代码优化]PHP代码优化

时间:2022-03-30 09:00:50
// Code snippet 1
$u_id = Hnb_Session::getInstance()->getUserID();
$arr_joinedTribeInfo = array();
if($u_id)
{
$arr_joinedTribeInfo = Hnb_Model_Tribe::getInstance()->getTribeInfoByJoiner($u_id);
$arr_joinedTribeInfo = empty($arr_joinedTribeInfo) ? array() : $arr_joinedTribeInfo;
} // After optimizing , code snippet 1
$u_id = Hnb_Session::getInstance()->getUserID();
$arr_joinedTribeInfo = empty($u_id) ? array() : Hnb_Model_Tribe::getInstance()->getTribeInfoByJoiner($u_id);