可能重复:
在php中使用没有循环的值填充数组
我已经购买了一个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')
Run Code Online (Sandbox Code Playgroud)
));
有没有什么快速的方法可以将它作为1到200的范围作为有效答案?我打了35并累了.
$array = range(1, 200);
Run Code Online (Sandbox Code Playgroud)
http://us2.php.net/manual/en/function.range.php