Validating data php
Cake PHP has many validation rules and using them can be quite easy.Some of the built-in rules allow you to verify the formatting of emails, URLs, and credit card numbers – but we’ll cover these in detail later on.The specified ‘rule’ may be the name of a method in your model, a method of the core Validation class, or a regular expression.
In this case, each ‘field Name’ consists of an array of rule indexes.
The next technique we’ll outline allows us to assign multiple validation rules per model field.
If you would like to assign multiple validation rules to a single field, this is basically how it should look: As you can see, this is quite similar to what we did in the previous section.
As the example above shows, a single field can have multiple validation rules.
And if the built-in rules do not match your criteria, you can always add your own validation rules as required.