我正在尝试将一个功能组合在一起isset,is_null以便于使用
我的方法:
class sys {
public static function is_null(&$variable) {
// if it's not set
if (!isset($variable)) {
return true;
}
// if array
if (is_array($variable)) {
return (boolean) (count($variable) < 1);
}
// if string
return (boolean) (strlen($variable) < 1);
}
}
Run Code Online (Sandbox Code Playgroud)
我在一个对象中使用它时遇到的问题是以下异常:
ErrorException [注意]:间接修改重载属性xxx无效.