note 107982 added to function.filter-input
| From: | chris at chlab dot ch | Date: | Tue, 20 Mar 2012 09:46:53 +0000 |
| Subject: | note 107982 added to function.filter-input | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186739@lists.php.net to get a copy of this message | ||
To use a class method for a callback function, as usual, provide an array with an instance of the
class and the method name.
Example:
<?php
class myValidator
{
public function username($value)
{
// return username or boolean false
}
}
$myValidator = new myValidator;
$options = array('options' => array($myValidator, 'username'));
$username = filter_input(INPUT_GET, 'username', FILTER_CALLBACK, $options);
var_dump($username);
?>
----
Server IP: 62.2.182.223
Probable Submitter: 77.58.126.233
----
Manual Page -- http://www.php.net/manual/en/function.filter-input.php
Edit -- https://master.php.net/note/edit/107982
Del: integrated -- https://master.php.net/note/delete/107982/integrated
Del: useless -- https://master.php.net/note/delete/107982/useless
Del: bad code -- https://master.php.net/note/delete/107982/bad+code
Del: spam -- https://master.php.net/note/delete/107982/spam
Del: non-english -- https://master.php.net/note/delete/107982/non-english
Del: in docs -- https://master.php.net/note/delete/107982/in+docs
Del: other reasons-- https://master.php.net/note/delete/107982
Reject -- https://master.php.net/note/reject/107982
Search -- https://master.php.net/manage/user-notes.php