Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //task 1
- $day = 25;
- if($day <=10){
- echo 'the number of first the decade';
- }
- elseif ($day <=20){
- echo 'the number of the second';
- }
- else { echo 'the number from the third decade';}
- //task 2
- $month = rand(1, 12);
- if ($month <= 2 || $month == 12) {
- echo 'winter';
- } elseif ($month > 2 && $month <= 5) {
- echo 'spring';
- } elseif ($month > 5 && $month <= 8) {
- echo 'summer';
- } else {
- echo 'autumn';
- }
- // task 3
- $year = 1004;
- if ($year % 4 == 0 && $year % 100 != 0) {
- echo 'leap_year';
- } elseif ($year % 400 == 0) {
- echo 'leap_year_too';
- } else {
- echo 'not_leap_year';
- }
- //task 4
- $i = 'abcde';
- if ($i{0} == 'a') {
- echo 'yes';
- } else {
- echo 'no';
- }
- //task 5
- $str = '512345';
- if ($str{0}==1||$str==2||$str==3) {
- echo "true";
- }
- else{
- echo "false";}
- // task 6
- $i= array(1,2,3);
- var_dump('i='.array_sum($i));
Add Comment
Please, Sign In to add comment