<form action="" method="get">
Data: <input type="text" name="data" maxlength="64" size="64"/><br/>
<input type="submit"/>
</form>
<?php
$filter = FILTER_CALLBACK;
$callback = array( 'options' => array( 'Validate', 'My' ) );
if (isset($_GET['data'])) {
$data = filter_input( INPUT_GET, 'data', $filter, $callback );
var_dump( $data );
}
class Validate {
function My( $text ) {
if ( $text == 'PHP' ) {
$text = 'PHP Rocks!';
return $text;
}
return false;
}
}
?>
Output