Skip to content

Instantly share code, notes, and snippets.

@ksnider
Created January 9, 2014 20:25
Show Gist options
  • Select an option

  • Save ksnider/8341345 to your computer and use it in GitHub Desktop.

Select an option

Save ksnider/8341345 to your computer and use it in GitHub Desktop.
<?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