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

Should I use mysqli or pdo?

521


Which variable declarations within a class is invalid in php?

510


How to find current date and time?

506


Which is variable cost?

534


What the limitation of header() function in php?

514






Does php have multiple inheritance?

518


How to pass an argument to a function?

559


Can php variables have numbers?

535


Do you know how can php and html interact?

549


What is the difference between php traits vs interfaces?

494


Do you know what's the difference between __sleep and __wakeup?

534


Define object-oriented methodology?

580


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

539


What are sql functions?

542


armstrong number by using php while number is given by the keyboard.?

1706