Skip to content

Instantly share code, notes, and snippets.

@apsolut
Created January 24, 2017 11:37
Show Gist options
  • Save apsolut/a80cc6da051b912dc5b3d4ef084c09df to your computer and use it in GitHub Desktop.
Save apsolut/a80cc6da051b912dc5b3d4ef084c09df to your computer and use it in GitHub Desktop.
PHP Switch statement..
<?php
switch(TRUE){
case email_is_valid($email):
// Do something.
break;
case username_is_valid($user):
// Do stuff.
break;
case pass_too_short($pass) && pass_not_save($pass):
// Other stuff.
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment