<html> <body> <?php $your_answer = "Yes"; if ( $your_name == "Yes") { echo Now I am the both the Happiest and Fattest man alive!'; } else { echo 'Jennifer Aniston is prettier than you!'; } echo 'I'm Brad Pitt's cousin, Fat Pitt.'; ?> </body> </html> Several things to note about the above code: 1) Jennifer Aniston is not hotter than Angelina Jolie, unless Jennifer Aniston or her lawyer are reading this, in which case she is very hot and a great actress to boot 2) If the value in $your_answer is equal to Yes, then the following will print: Now I am both the Happiest and Fattest man alive! I'm Brad Pitt's cousin, Fat Pitt. If the value in $your_answer had not been Yes, this would have printed: Jennifer Aniston is prettier than you! I'm Brad Pitt's cousin, Fat Pitt. Note that either way the line: I'm Brad Pitt's cousin, Fat Pitt prints out. This is because that echo is placed outside of the IF...Else statement and prints regardless of whether the criteria is met.
blog comments powered by Disqus |
|
|
|
|
|
|
|