samedi 31 mai 2014

PHP filter_input were validatio flags are an enum?


Vote count:

0




Looked around but didn't see this anywhere, the basic question is, can I use a filter_input_array were the value of one of my keys is an enum (think mysql enum), protocode would be something like this.



print_r(filter_input_array(INPUT_POST, [
'CanBeFooOrBar' => [
'filter' => FILTER_VALIDATE_ENUM,
'options' => ['foo', 'bar'],
]
]));


If this is possible, what is my filter, and if not, what would be the best way to replicate this behavior?



asked 23 secs ago

ehime

1,884





Aucun commentaire:

Enregistrer un commentaire