How to add some flag to the ext/Filter?
| From: | Chi-BiN Hsiao | Date: | Sun, 14 Dec 2008 14:48:37 +0000 |
| Subject: | How to add some flag to the ext/Filter? | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-5998@lists.php.net to get a copy of this message | ||
Hi All
I am a beginner to PHP extension. And I want to add a flag named
"FILTER_FLAG_STRIP_WHITESP", and associate this flag with
FILTER_UNSAFE_RAW so that the ext/filter will auto trim
$_GET/$_POST/$_REQUEST using the default filter..
At present, we should trim these data using code like this:
<?php
function trim_value(&$value){
$value = trim($value);
}
array_walk_recursive($_POST,'trim_value');
?>
I think we can do this job with less code, and get better performance
with ext/filter.
But I don't know how to do this work. Would any one please tell me how
to? thank you.
Best Reguards,
--
Chi-BiN Hsiao