0%

php脚本按数字顺序创建文件

 $file) {
            preg_match($patterns, $file, $prefix[$key]);
        }
        $fileNum = [];
        if (!empty($prefix)) {
            foreach ($prefix as $key => $item) {
                if (!empty($item)) {
                    $fileNum[] = $item[0];
                }
            }
        }
        if (!empty($fileNum)) {
            $maxNumIndex = array_search(max($fileNum), $fileNum);
            $maxNum = $fileNum[$maxNumIndex];
        }
        $maxNum++;
    }
    return $maxNum;
}