Re: Simple variable handling.

From: Date: Fri, 12 Aug 2016 15:19:40 +0000
Subject: Re: Simple variable handling.
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-95099@lists.php.net to get a copy of this message
On 12/08/16 12:13, Yasuo Ohgaki wrote: >> I may be missing something, but I thought the original code had rules >> > for each element of the array? I would certainly expect to see the >> > capability of setting different validating rules for each element, and >> > the rules you are defining are the same rules that would be needed on a >> > variable by variable basis? > You can do > > $get_def_for_an_api = array( > 'date' => $my_date_spec, > 'bookname' => $my_bookname_spec, > 'isbn' => $my_isbn_spec, > ); > > filter_require_var_array($_GET, $get_def_for_an_api); > > One missing validation filter is "optional" filter. I may add this > later or now before starting vote. But my point is you have code to process the rule set $my_date_spec against the variable $date and ditto on bookname and isbn. All three of them are elements I have user land code to validate, and I don't see what is so special about making that validation available inside an array against simply having $date->rules($my_date_spec) and return $date->valid; ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.internals (#95099) next »