<?php




//$rank = 19010;
//if ($rank >= 10000) {
//    $mod = intval($rank / 10000);
//    echo $rank - $mod * 10000 + 1;
//}

//echo intval(substr(strval($rank), -4)) + 1;

//function getFormatArray4(string $str): array
//{
//    $data = array();
//    if ($str == "None" || $str == "0") {
//        return $data;
//    }
//    $tmp = explode("|", $str);
//    foreach ($tmp as $i => $str1) {
//        $tmp2 = explode("*", $str1);
//        $key = intval($tmp2[0]);
//        $val = intval($tmp2[1]);
//        $data[$i] = array($key => $val);
//    }
//    return $data;
//}
//
//$str = "11*1|22*2|11*3";
//var_dump(getFormatArray4($str));
//function checkIsToday(int $time): bool
//{
//    if ($time == 0) {
//        return true;
//    }
//    $date = date("Y-m-d", $time);
//    $today = date("Y-m-d");
//    if ($date === $today) {
//        return true;
//    }
//    return false;
//}
//var_dump(checkIsToday(1651127117));

//$expireTime = strtotime(date("Y-m-d", strtotime("+1 day"))) + 1;
//echo $expireTime;
//$time = 1641560399;             //2022-01-07
//$seasonStartTime = 1639745999;  //2021-12-17
//$nowWeek = date("W", $time);
//$seasonStartWeek = date("W", $seasonStartTime);
//
//$nowWeek = date("W", $time);
//if ($nowWeek >= $seasonStartWeek) {
//    $week = $nowWeek - $seasonStartWeek + 1;
//} else {
//    //跨年了
//    $year = intval(date("Y")) - 1;
//    $lastYearWeek = date("W", strtotime(strval($year)."-12-28"));
//    $week = $lastYearWeek - $seasonStartWeek + $nowWeek + 1;
//}
//echo $week;

//$t = 1649894400;
//$t = time();
//echo date("W", $t)."\n";
//echo date("w", $t)."\n";
//echo date("N", $t)."\n";
//
//$today = date("Y-m-d");
//$w = date("w", strtotime($today));
//$week_start = date("Y-m-d", strtotime("$today -".($w ? $w-1:6)."days"));
//echo $week_start;

//$w = date("N", 1672232399); //1-7   2022-12-28
////echo $w;
//$d = (8 -$w);
////echo strtotime(date("Y-m-d")."+$d days");
//echo strtotime("2022-12-28"."+$d days");

//var_dump(boolval(1));

//echo strtotime(date("Y-m-d",strtotime("+1 day")));

//function StringToTime($val, &$ret)
//{
//    try {
//        $date = new DateTime ($val);
//    } catch (Exception $e) {
//        return false;
//    }
//    $ret = $date->getTimestamp();
//    return true;
//}
//
//$val = "2022-5-1 23:59:59";
//$ret = 0;
//StringToTime($val, $ret);
//echo $ret;


//$a = array_fill(0, 5, 1);
//var_dump($a);

//$a = 2/3;
//echo number_format($a, 1);
//echo random_int(1,2);

//$arr2 = array("1a"=>111,"14a"=>22,"13a"=>33);
//$arr3 = array_merge($arr, $arr2);
//unset($arr[4]);
//arsort($arr);
//var_dump($arr);
//echo lcg_value();

//$key = 1;
//$k = isset($arr[$key]) ? $arr[$key] : null;
//$k = $arr[$key] ?? null;
//var_dump($k);
//$indexArr = range(3,7);
//for ($i = 3; $i <= 6; $i++) {
//    array_push($indexArr, $i);
//}
//var_dump($indexArr);

//$arr = array("a" => 1);
//$receiveTime = $arr["a"] ?? time();
////$receiveTime = isset($arr['a']) ? $arr['a'] : 2;
//echo $receiveTime;

//trait tt
//{
//    private int $a;
//    private array $arr;
//
//    private function init()
//    {
//        $this->a = 1;
//        $this->arr[0] = 'adsfdsf';
//    }
//    public function p()
//    {
//        $this->init();
//        var_dump($this->a);
//        var_dump($this->arr);
//    }
//
//    public function p2()
//    {
//        $this->a = 4;
//        var_dump($this->a);
//    }
//}
//
//
//class Test
//{
//    use tt;
//
//    public function test1()
//    {
//        $this->p();
//    }
//
//    public function test2()
//    {
//        $this->p2();
//    }
//}
//
//$test = new Test();
//$test->test1();
//$test->test2();