Monday, 15 February 2010

php - Build custom FILTER_VALIDATE_XY for filter_input_array -



php - Build custom FILTER_VALIDATE_XY for filter_input_array -

i cant find building custom validation function utilize within filter_input_array.

is there possibility validate against 1 of own functions?

something like

function filter_custom_function($input) { // } $filter = array( 'id' => filter_validate_int, 'action' => filter_sanitize_string, 'custom_var' => filter_custom_function ); $myarray = filter_input_array(input_get, $filter);

the solution keyword "filter_callback":

function check_languages($var) { static $called = 0; $called++; echo "called: $called: $var<br />"; $var = filter_var($var, filter_sanitize_stripped); $l = new language($var); homecoming $l; } $filter = array( 'favourites' => array( 'filter' => filter_callback, 'options' => 'check_languages' ) );

via http://devzone.zend.com/703/php-built-in-input-filtering/

php validation passwords

No comments:

Post a Comment