Home of web learners
PHP has function to filter data
When you take input from front end side to backend server,you need to check data
Some times you want numerical data,but user give textual data,so need to filter
Lets look an example:
Here,you see that we are going to validate that data need to be integer.
To check,first variable data we assign integer and second one is text,in if function we use the builtin function to filter data filter_var,here first one is variable,then second argument is which kind of data need to be as we check.
Here,if the variable data is integer then if is true and it shows Integer is valid nad for next check for $data2,if is false,so it execute else body block