karlakmkj

identical operator

Sep 17th, 2021
717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. namespace Codecademy;
  3.  
  4. // identical operators - stricter than using equal operator ==
  5. function agreeOrDisagree($first, $second){
  6.   if ($first === $second){
  7.     return "You agree!";
  8.   } else {
  9.     return "You disagree!";
  10.   }
  11. }
  12.  
  13. echo agreeOrDisagree(5,5);
  14. echo "\n\n";
  15. echo agreeOrDisagree("sing", "song");
  16.  
  17. function checkRenewalMonth($renewal_month){
  18.   $current_month = date("F");  //using the date function
  19.   if ($current_month === $renewal_month){
  20.     return "Time to renew";
  21.   } else {
  22.     return "Welcome!";
  23.   }
  24. }
  25. echo checkRenewalMonth("August"); //month must be captialised for first letter
  26. echo "\n";
  27. echo checkRenewalMonth("September");
RAW Paste Data