Pierre wrote:
I put a small example here:
http://pecl.php.net/~pierre/filter_input_get_args_example.phps

and the patch:
http://pecl.php.net/~pierre/patch_filter_input_get_args.txt

I think this looks ok. I have been trying to come up with a shorter and cleaner syntax to specify these things, but so far I haven't come up with anything I really like. The closest I have come is something like this:

$args = array(
    'product_id'   => 'Enc',
    'component'    => 'Int:Array:1-10',
    'versions'     => 'Enc',
    'doesnotexist' => 'Int',
    'testscalar'   => 'Int:Scalar',
    'testarray'    => 'Int:Array'
);

But I am not completely happy with the magic shortcuts in the strings there. The above would be equivalent to:

$args = array(
    'product_id'    => FILTER_SANITIZE_ENCODED,
    'component'     => array('filter'    => FILTER_VALIDATE_INT,
                             'flags'    => FILTER_FLAG_ARRAY,
'options' => array("min_range"=>1, "max_range"=>10)
                        ),
    'versions'      => FILTER_SANITIZE_ENCODED,
    'doesnotexist'  => FILTER_VALIDATE_INT,
    'testscalar'    => array(
                                'filter' => FILTER_VALIDATE_INT,
                                'flags'  => FILTER_FLAG_SCALAR,

                            ),
    'testarray'    => array(
                                'filter' => FILTER_VALIDATE_INT,
                                'flags'  => FILTER_FLAG_ARRAY,
                            )

);

-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to