Codeigniter: Make field increase by 1 up to a number?
Posted
by Kevin Brown
on Stack Overflow
See other posts from Stack Overflow
or by Kevin Brown
Published on 2010-01-03T23:51:12Z
Indexed on
2010/04/25
4:33 UTC
Read the original article
Hit count: 434
In my validation class I have this:
$fields['a_1'] = 'First Question';
$fields['a_2'] = 'Second Question';
$fields['a_3'] = 'Third Question';
$fields['a_4'] = 'Fourth Question';
This is getting old--I have about 40 of these to write, and each set has matching validation rules:
$rules['a_1'] = 'hour';
$rules['a_2'] = 'hour';
...
Is there a way to say:
$fields['a_' . 1 - 17] = "One, Two"
Etc...
Just curious... if not, I'll brute force it.
© Stack Overflow or respective owner