Hello,
I would like to know what is the difference between:
public function rules(){
return [
[['number'],'number'],
and
[['number'],'integer'],
];
}
Please,
Thank you
Hello,
I would like to know what is the difference between:
public function rules(){
return [
[['number'],'number'],
and
[['number'],'integer'],
];
}
Please,
Thank you
I think the major difference between the 2 is integer validates only whole numbers like 1, 2 , 3, where as number is like double validates decimal numbers like 1.1, 1.2
According to the docs they are the same thing. It doesn’t even list number as one. But if you look at integer it says it uses number validater. If I where you I’d just use integer. That would be cool if it did decimals… I’m going to check it out later.
You can specify your own regex for them to match whatever too ie integer or whole numbers.
I don’t think that is true:
http://www.yiiframework.com/doc-2.0/guide-tutorial-core-validators.html
double and number core validators are equivalent. Both check for double values. integer checks for whole numbers.
Best,
Joe