PHP Filter_Callback Filter
What is FILTER_CALLBACK Filter in PHP?
Explanation
PHP FILTER_CALLBACK is used to call a user defined function or any PHP function to filter and validate the value.
Name: "callback"
ID-number: 1024
Example :
<?php
$string="We welcome you to Hscripts.com";
echo filter_var($string, FILTER_CALLBACK, array("options"=>"ucwords"));
?>
Result :
We Welcome You To Hscripts.com
In the above example, the first character of each word in the given sentence is capitalized.
Here the user defined functions is $string which is validated and the output is given.