- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1046 Articles for PHP
256 Views
The FILTER_VALIDATE_BOOLEAN constant validates value as a boolean option.ReturnThe FILTER_VALIDATE_BOOLEAN constant returns TRUE for "1", "true", "on" and "yes". It returns FALSE for "0", "false", "off" and "no" otherwise, NULL.Example Live DemoOutputThe following is the output.bool(true)ExampleLet us see another example.OutputHere is the output.bool(false)
374 Views
The filter_var() function is used to filter a variable with a specified filter.Syntaxfilter_var(variable, filter, options)Parametersvariable − The name of variable.filter − The name of filter to get ID.options − Specifies options to use.ReturnThe filter_var() function returns filtered data on success, or false on failure.Example Live Demo
454 Views
The filter_var_array() function is used to filter multiple variables. Syntax filter_var_array(arrayname, parameters) Parameters arrayname − An array to filter the data. parameters − It specifies an array of filter arguments. Return The filter_var_array() function returns an array of values of the requested variables on success or false on failure. Example Live Demo The following is the output. Array ( [stname] => Jack [stmarks] => 95 [stemail] => jack@abcde.com )
361 Views
The filter_list() function is used to list all supported filters.Syntaxfilter_list()ReturnThe filter_list() function returns an array of filters available. It returns an empty array if there are no filters.Example Live DemoOutputThe following is the output.int257 boolean258 float259 validate_regexp272 validate_domain277 validate_url273 validate_email274 validate_ip275 validate_mac276 string513 stripped513 encoded514 special_chars515 full_special_chars522 unsafe_raw516 email517 url518 number_int519 number_float520 magic_quotes521 callback1024
400 Views
The filter_input_array() function gets names of external variables and filters them optionally. Syntax filter_input_array(type, arraydefine, add_empty) Parameters type − There are five types of inputs to check i.e. INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV. arraydefine − It specifies an array of filter arguments. It is optional. add_empty − If value is True, it adds missing keys as NULL to the return value. Return The filter_input_array() function returns an array containing the values of the variables on success, or false on failure. Example The following is an example that use the filter_input_array() function to filter POST ... Read More
491 Views
The filter_input() function gets a name of external variable and filters it optionally.Syntaxfilter_input(type, var, filtername, options)Parameterstype − There are five types of inputs to check i.e. INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV.var − The name of variable.filtername − The name of filter to get ID.options − Specifies options to use.ReturnThe filter_input() function returns the value of the variable on success, false on failure, or null if the parameter of variable is not set.Example Live Demo
215 Views
The filter_id() function returns the filter ID of provided filter name.Syntaxfilter_id(filtername)Parametersfiltername − The name of filter to get the ID from.ReturnThe filter_id() function returns filter ID on success or FALSE, if the filter does not exist.ExampleOutputThe following is the output.int = 257 boolean = 258 float = 259 validate_regexp = 272 validate_domain = 277 validate_url = 273 validate_email = 274 validate_ip = 275 validate_mac = 276 string = 513 stripped = 513 encoded = 514 special_chars = 515 full_special_chars = 522 unsafe_raw = 516 email = 517 url = 518number_int = 519 number_float = 520 magic_quotes = 521 callback = 1024
299 Views
The filter_has_var() function is used to check that variable of specified type exists or not.Syntaxfilter_has_var(type, var)Parameterstype − There are five types of inputs to check i.e. INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV.var − The name of variable.ReturnThe filter_has_var() function returns true on success and false on failure.ExampleThe following is an example that is a quick check for the input variable "email”. The value INPUT_GET is used for this. Live Demo
68 Views
The tanh() function returns the hyperbolic tangent of the specified value.Syntaxtanh(val)Parametersval − A value in radiansReturnThe tanh() function returns the hyperbolic tangent of the specified value val.ExampleThe following is an example to get the hyperbolic tangent of 0 and 1: Live DemoOutput00.76159415595576ExampleLet us see an example to get the hyperbolic tangent of constant M_PI_4 − Live DemoOutput0.65579420263267ExampleLet us see an example to get the hyperbolic tangent of values 0.50 and -0.50 − Live DemoOutput0.46211715726001-0.46211715726001ExampleLet us see another example to get the hyperbolic tangent of negative values − Live DemoOutput-0.9999092042626-0.99999999587769