Skip to content

Instantly share code, notes, and snippets.

@MattSurabian
Created May 5, 2013 20:39
Show Gist options
  • Save MattSurabian/5522097 to your computer and use it in GitHub Desktop.
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
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