Guest User

Untitled

a guest
Feb 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. //task 1
  2. $day = 25;
  3. if($day <=10){
  4. echo 'the number of first the decade';
  5. }
  6. elseif ($day <=20){
  7. echo 'the number of the second';
  8. }
  9. else { echo 'the number from the third decade';}
  10.  
  11.  
  12. //task 2
  13. $month = rand(1, 12);
  14. if ($month <= 2 || $month == 12) {
  15. echo 'winter';
  16. } elseif ($month > 2 && $month <= 5) {
  17. echo 'spring';
  18. } elseif ($month > 5 && $month <= 8) {
  19. echo 'summer';
  20. } else {
  21. echo 'autumn';
  22. }
  23.  
  24.  
  25. // task 3
  26. $year = 1004;
  27. if ($year % 4 == 0 && $year % 100 != 0) {
  28. echo 'leap_year';
  29. } elseif ($year % 400 == 0) {
  30. echo 'leap_year_too';
  31. } else {
  32. echo 'not_leap_year';
  33. }
  34.  
  35. //task 4
  36. $i = 'abcde';
  37. if ($i{0} == 'a') {
  38. echo 'yes';
  39. } else {
  40. echo 'no';
  41. }
  42. //task 5
  43. $str = '512345';
  44. if ($str{0}==1||$str==2||$str==3) {
  45. echo "true";
  46. }
  47. else{
  48. echo "false";}
  49.  
  50. // task 6
  51. $i= array(1,2,3);
  52. var_dump('i='.array_sum($i));
Add Comment
Please, Sign In to add comment