The switch statement


SUBMITTED BY: henry1874w

DATE: June 12, 2017, 4:11 p.m.

FORMAT: Text only

SIZE: 436 Bytes

HITS: 278

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. $favcolor = "red";
  6. switch ($favcolor) {
  7. case "red":
  8. echo "Your favorite color is red!";
  9. break;
  10. case "blue":
  11. echo "Your favorite color is blue!";
  12. break;
  13. case "green":
  14. echo "Your favorite color is green!";
  15. break;
  16. default:
  17. echo "Your favorite color is neither red, blue, nor green!";
  18. }
  19. ?>
  20. </body>
  21. </html>

comments powered by Disqus