Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2.  
  3. function greet($name, $owner) {
  4. return $name == $owner ? "Hello boss" : "Hello ${name}";
  5. }
  6.  
  7. function isOrdered($a,$b,$c) {
  8. return ( ( $a < $b && $b < $c ) || ( $a > $b && $b > $c ) );
  9. }
  10.  
  11. function getDay($day) {
  12.  
  13. $dayF = --$day;
  14.  
  15. $days = [
  16. "Lundi",
  17. "Mardi",
  18. "Mercredi",
  19. "Jeudi",
  20. "Vendredi",
  21. "Samedi",
  22. "Dimanche"
  23. ];
  24.  
  25. return isset( $days[$dayF] ) ? $days[$dayF] : "Ce jour n'existe pas";
  26.  
  27. }
  28.  
  29. function getSeason($month) {
  30.  
  31. if ( $month > 12 || $month < 1 )
  32. die ("This month doesnt exist");
  33.  
  34. switch(true) {
  35.  
  36. case $month:
  37. echo "Winter";
  38. break;
  39. case 4:
  40. case 5:
  41. case 6:
  42. echo "Printemps";
  43. break;
  44. case 7:
  45. case 8:
  46. case 9:
  47. echo "Ete";
  48. break;
  49. case 10:
  50. case 11:
  51. case 12:
  52. echo "Automne";
  53. break;
  54.  
  55. }
  56.  
  57. }
  58.  
  59. //echo greet("robin", "robin");
  60. //var_dump( isOrdered(3, 6, 1) );
  61. //echo getDay(1);
  62. //getSeason( 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement