+ add the function of zset().
This commit is contained in:
@@ -499,6 +499,27 @@ function a($var)
|
||||
echo "</xmp>";
|
||||
}
|
||||
|
||||
/**
|
||||
* When the $var has the $key, return it, esle result one default value.
|
||||
*
|
||||
* @param array|object $var
|
||||
* @param string|int $key
|
||||
* @param mixed $valueWhenNone value when the key not exits.
|
||||
* @param mixed $valueWhenExists value when the key exits.
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function zset($var, $key, $valueWhenNone = '', $valueWhenExists = '')
|
||||
{
|
||||
$var = (array)$var;
|
||||
if(isset($var[$key]))
|
||||
{
|
||||
if($valueWhenExists) return $valueWhenExists;
|
||||
return $var[$key];
|
||||
}
|
||||
return $valueWhenNone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge the server ip is local or not.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user