Created
January 9, 2014 20:25
-
-
Save ksnider/8341345 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| // Simple IF statements | |
| If($contactId == 1234) { | |
| $tagId = 26; | |
| } | |
| If($contactId !== 1234) { // ! means Not | |
| $tagId = 28; | |
| } | |
| If($tagId == 26 && $age >= 18) { // && means AND || means or | |
| echo 'No need for parent or guardian to sign'; | |
| } | |
| // If ELSE statment | |
| If($tagId == 26 || $age >= 18) { | |
| echo 'No need for parent or guardian to sign'; | |
| } else { | |
| echo 'Parent or guardian must also sign'; | |
| } | |
| // Nested If statements | |
| If($breed == 'dog' ) { | |
| echo 'This is a canine'; | |
| } else { | |
| If($breed == 'horse') { | |
| echo 'This is an equine'; | |
| } else { | |
| echo 'We are not sure what you are'; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment