People are always asking what if. What if I weren't the world's fattest man? What if I poured vodka into that Kool-Aid guy's body -- would he get drunk? I mean technically the dude is already wired. Why else would he just crash through people's wall and yell his name? As I said before, we already previewed the IF statement in our previous article. However, I will show it to you one more time here, just as a refresher. The basic idea of an If statement is: If this, do that. <html> <body> <?php $your_name = "Angelina Jolie"; if ( $your_name == "Angelina Jolie") { echo 'Will you marry me?'; } ?> </body> </html> In the above code, we store the name "Angelina Jolie" in a variable. We then say that if the value in $your_name is in fact "Angelina Jolie" print the line: Will you Marry me? If the value of $your_name had been any other value, nothing would have happened. But what good is that program if we don't get an answer? For that, let's use the If...Else statement.
blog comments powered by Disqus |