Created
May 5, 2013 20:39
-
-
Save MattSurabian/5522097 to your computer and use it in GitHub Desktop.
The method I use when validating multiple input options in class setters. Embeded in my blog post http://mattsurabian.github.io/PHP/validating-multiple-input-options-in-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!in_array(strtolower($input), array('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'))){ | |
return false; | |
//or throw an exception | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment