How to use validations in php?(codelgniter)

Answer Posted / vileye

There are various ways to validate a data in php. It depends
on what you want to validate. The various validations are as
follows:

FILTER_VALIDATE_INT Validate value as integer, optionally
from the specified range
FILTER_VALIDATE_BOOLEAN Return TRUE for "1", "true", "on"
and "yes", FALSE for "0", "false", "off", "no", and "", NULL
otherwise
FILTER_VALIDATE_FLOAT Validate value as float
FILTER_VALIDATE_REGEXP Validate value against regexp, a
Perl-compatible regular expression
FILTER_VALIDATE_URL Validate value as URL, optionally with
required components
FILTER_VALIDATE_EMAIL Validate value as e-mail
FILTER_VALIDATE_IP Validate value as IP address, optionally
only IPv4 or IPv6 or not from private or reserved ranges

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by public, private, protected, static and final scopes?

772


What is the default session time in php?

739


When should you use a stored procedure?

728


How to delete a file from the system?

805


Where can I find php ini file?

718


What is the difference between characters 34 and x34?

723


What does trim () do in javascript?

779


What is the empty function?

738


What is php constructor?

804


How check field is empty or not in php?

796


How many escape sequences are recognized in double-quoted strings?

795


What is the difference between php traits vs interfaces?

708


What is the use of preg_match in php?

744


I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what is the problem?

732


What is the importance of "method" attribute in a html form?

798