> -----Original Message----- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] > Sent: 02 May 2006 07:42 > To: [EMAIL PROTECTED] > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] ext/filter, add input_get_args, > support of scalar orarray result > > 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' > );
Would a little helper function to create the array be a little neater (and less typing :) for the more common complex options? $args = array( 'component' => somefunc(FILTER_VALIDATE_INT, FILTER_FLAG_ARRAY, 1, 10); ); > > 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, > ) > > ); Jared -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php