身份证号码
可以验证15和18位的身份证号码

@param string $var
@return bool
497895
public static function idCard($var)
	{
		$province = [
		    "11", "12", "13", "14", "15",
		    "21", "22", "23",
		    "31", "32", "33", "34", "35", "36", "37",
		    "41", "42", "43", "44", "45", "46",
		    "50", "51", "52", "53", "54",
		    "61", "62", "63", "64", "65",
		    "71", "81", "82", "91"
		];
		//前两位的省级代码
		if(!in_array(substr($var, 0, 2), $province)) {
			return false;
		}

		if(strlen($var) == 15) {
			if(!preg_match("/^\\d+$/", $var)) {
				return false;
			}
			// 检查年-月-日（年前面加19）
			return checkdate(substr($var, 8, 2), substr($var, 10, 2), "19" . substr($var, 6, 2));
		}

		if(strlen($var) == 18) {
			if(!preg_match("/^\\d+$/", substr($var, 0, 17))) {
				return false; // 前17位是否是数字
			}

			//检查年-月-日
			if(!@checkdate(substr($var, 10, 2), substr($var, 12, 2), substr($var, 6, 4))) {
				return false;
			}

			//加权因子Wi=2^（i-1）(mod 11)计算得出
			$Wi_arr = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];

			//校验码对应值
			$VN_arr = [1, 0, 'x', 9, 8, 7, 6, 5, 4, 3, 2];

			//计算校验码总值(计算前17位的，最后一位为校验码)
			$t = '';

			$var = strtolower($var);
			for($i = 0; $i < strlen($var) - 1; $i++) {
				$t += substr($var, $i, 1) * $Wi_arr[$i];
			}
			//得到校验码
			$VN = $VN_arr[($t % 11)];

			//判断最后一位的校验码
			if($VN == substr($var, - 1)) {
				return true;
			} else {
				return false;
			}
		}

		return false;
	}
770977
public function setIsCurrentValue($var)
    {
        $wrappedVar = is_null($var) ? null : new \Google\Protobuf\BoolValue(['value' => $var]);
        return $this->setIsCurrent($wrappedVar);
    }
1261921
public function readLittleEndian64(&$var)
    {
        $data = null;
        if (!$this->readRaw(4, $data)) {
            return false;
        }
        $low = unpack('V', $data)[1];
        if (!$this->readRaw(4, $data)) {
            return false;
        }
        $high = unpack('V', $data)[1];
        if (PHP_INT_SIZE == 4) {
            $var = GPBUtil::combineInt32ToInt64($high, $low);
        } else {
            $var = ($high << 32) | $low;
        }
        return true;
    }
392599
public static function isEmpty($var) 
	{	
		$toReturn = false;

		if(is_array($var) && empty($var)) {
			$toReturn = true;
		}

		if(is_string($var) && ($var =='' || is_null($var))) {
			$toReturn = true;
		}

		if(is_integer($var) && ($var =='' || is_null($var)) ) {
			$toReturn = true;
		}

		if(is_float($var) && ($var =='' || is_null($var)) ) {
			$toReturn = true;
		}

		return $toReturn;
	}
175535
public function getParam($var = null)
    {
        $param = $this->_parameters;
        if (null !== $var) {
            if (isset($this->_parameters[$var])) {
                $param = $this->_parameters[$var];
            } else {
                $param = null;
            }
        }

        return $param;
    }
39855
public function expires($var = null)
    {
        if ($var !== null) {
            $this->expires = $var;
        }

        return $this->expires ?? Grav::instance()['config']->get('system.pages.expires');
    }
525407
public function date($var = null)
    {
        if ($var !== null) {
            $this->date = Utils::date2timestamp($var, $this->dateformat);
        }

        if (!$this->date) {
            $this->date = $this->modified;
        }

        return $this->date;
    }
1222977
static function strtolowerplus($var)
    {
        if(is_string($var)) {
            return strtolower($var);
        }

        //标明var类型
        $flag = false;

        if(is_array($var)) {
            $flag = true;
        }

        return json_decode( strtolower( json_encode($var) ), $flag);
    }
872967
public function getInferedType($variable)
    {
        if (isset($this->variables[$variable])) {
            $type = $this->variables[$variable];
            if ('variable' != $type && 'undefined' != $type && 'string' != $type && 'istring' != $type && 'array' != $type && 'null' != $type && 'numeric' != $type) {
                //echo $variable, ' ', $type, PHP_EOL;
                return $type;
            }
        }

        return false;
    }
1229836
private function _setSecureArray($var) {
        if (is_array($var)) {
            foreach ($var as $key => $value) {
                $var['' . $key . ''] = $this->_setSecureArray($value);
            }
        }
        else {
            $var = htmlentities($var);
        }

        return $var;
    }
1042006
public function varDump($var)
    {
        if (is_callable($this->varDumpCallback)) {
            return call_user_func($this->varDumpCallback, $var, $this);
        }

        $message = VarDumper::dumpAsString($var, $this->depth, $this->highlight);

        //don't encode highlighted variables
        if (!$this->highlight) {
            $message = Html::encode($message);
        }

        return $message;
    }
685711
protected function validate_string_length( $var, $len ) {
		if ( ! is_string( $var ) ) {
			return new \WP_Error( 400, $this->app->translate( 'Invalid format.' ) );
		}

		if ( strlen( $var ) > $len ) {
			return new \WP_Error( 400, $this->app->translate( 'Input value is too long.' ) );
		}

		return true;
	}
294044
public function eTag($var = null)
    {
        if ($var !== null) {
            $this->etag = $var;
        }
        if (!isset($this->etag)) {
            $this->etag = (bool)Grav::instance()['config']->get('system.pages.etag');
        }

        return $this->etag;
    }
596557
public function unsetVariable($variable)
    {
        // Encrypt variable name?
        if (true === $this->hasEncryption()) {
            $variable = $this->encrypt($variable);
        }

        unset($_SESSION[$variable]);

        return (false === $this->issetVariable($variable));
    }
662484
public function setStringValue($var)
    {
        GPBUtil::checkString($var, False);
        $this->string_value = $var;
        $this->has_string_value = true;

        return $this;
    }
604275
public function load( $var )
    {
        $success = true;
        $val = apc_fetch( $this->_prefix . $var, $success );

        if( $success === false )
            return null;

        return $val;
    }
994150
public static function type_float($var)
	{
		if (is_array($var) or is_object($var))
		{
			throw new InvalidContentType('Array or object could not be converted to float.');
		}

		// deal with locale issues
		$locale_info = localeconv();
		$var = str_replace($locale_info["mon_thousands_sep"] , "", $var);
		$var = str_replace($locale_info["mon_decimal_point"] , ".", $var);

		return floatval($var);
	}