Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php数组从1到200有什么快速的方法吗?_Php_Arrays_Range - Fatal编程技术网

php数组从1到200有什么快速的方法吗?

php数组从1到200有什么快速的方法吗?,php,arrays,range,Php,Arrays,Range,可能重复: 我买了一个php联系人表单,我正在尝试制作一个验证器。 因此,不要像这样键入: $amount->addValidator('identical', array( 'token' => array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '2

可能重复:

我买了一个php联系人表单,我正在尝试制作一个验证器。 因此,不要像这样键入:

$amount->addValidator('identical', array( 
'token' => array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35')
)

有没有什么快速的方法可以将其作为1到200的有效答案?我打了35,累了

$array = range(1, 200);

您可以使用范围函数生成包含1到200个元素的数组

$arr = range(1,200);