diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index aa72aff..e2e4e6f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,176 @@ + + +<<<<<<< HEAD +======= + + +>>>>>>> less2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<<<<<<< HEAD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +======= + + + + + + + + +>>>>>>> less2 + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + +<<<<<<< HEAD + +======= +>>>>>>> less2 + + + + + + + + + + + + + + + + + + + @@ -12,4 +179,115 @@ + + + + + + + + + + 1550516049828 + + + + +<<<<<<< HEAD + + + + + + + + +======= + + + + + + + + + + + + +>>>>>>> less2 + + + + + + + +<<<<<<< HEAD + + + + + + + + + +======= + + + + +>>>>>>> less2 + + + + + + + + + + + + + + + + +<<<<<<< HEAD + + + + + +======= + + +>>>>>>> less2 + + + + \ No newline at end of file diff --git a/less1.php b/less1.php new file mode 100644 index 0000000..41d5227 --- /dev/null +++ b/less1.php @@ -0,0 +1,55 @@ + + + + + +

+
+ + +
+
+//task5 +
+'; +echo 'b=' .$b; + + diff --git a/less2.php b/less2.php new file mode 100644 index 0000000..570c0fb --- /dev/null +++ b/less2.php @@ -0,0 +1,151 @@ +task1
+= 0 && $b >= 0) { + echo $a - $b; +} else if ($a < 0 && $b < 0) { + echo $a * $b; +} else { + echo $a + $b; +} +?> +
+
+task2 +
+ +
+
+task3 +
+ +
+
+task4 +
+ + + + + + +
+
+
+task6
+ + +
+
+
+task7 +
+
+= 11 && $num <= 14) { + return $num.' '.$text2; + } else if ($num_end >= 2 && $num_end <= 4) { + return $num.' '.$text3; + } else if($num == 1 && $num_end == 1) { + return $num. ' '.$text1; + } else if ( $num >= 2 && $num <= 4 ) { + return $num.' '.$text3; + } else { + return $num.' '.$text2; + } +} + +echo plur(22, 'час', 'часов', 'часа'). + ' '.plur(15, 'минута','минут', 'минуты' ); +echo "
"; +echo plur(21, 'час', 'часов', 'часа'). + ' '.plur(43, 'минута','минут', 'минуты' ); diff --git a/less3.php b/less3.php new file mode 100644 index 0000000..536d9fa --- /dev/null +++ b/less3.php @@ -0,0 +1,197 @@ +'; + } + $i++; + } +} +third(); +?> +
+
+
+
+'; + } else if ($i % 2 == 0) { + echo $i. ' – четное число.
'; + } else { + echo $i. ' – нечетное число.
'; + } + $i++; + } while($i <=10); +} +task2(); +?> +
+
+
+ + array("Москва", "Зеленоград", "Клин" ), + "Тульская область" => array("Тула", "Алексин", "Белев"), + "Ленинградская область" => array("Санкт-Петербург", "Всеволожск", "Павловск", "Кронштадт") + ); + + foreach ($array as $key => $value) { + echo $key . ':
'; + for ($i = 0; $i <= count($value); $i++ ) { + echo $value[$i].', '; + } + echo '

'; + } + +//task4 +function translit($str) +{ + $arr = array( + 'а' => 'a', + 'б' => 'b', + 'в' => 'v', + 'г' => 'g', + 'д' => 'd', + 'е' => 'e', + 'ж' => 'j', + 'з' => 'z', + 'и' => 'i', + 'к' => 'k', + 'л' => 'l', + 'м' => 'm', + 'н' => 'n', + 'о' => 'o', + 'п' => 'p', + 'р' => 'r', + 'с' => 's', + 'т' => 't', + 'у' => 'y', + 'ф' => 'f', + 'x' => 'kh', + 'ц' => 'ts', + 'ч' => 'ch', + 'ш' => 'sh', + 'щ' => 'shch', + 'ъ' => '“', + 'ы' => 'y', + 'ь' => '‘', + 'э' => 'eh', + 'ю' => 'yu', + 'я' => 'ya' + ); + + $str = strtr($str, $arr); + $str = mb_strtolower($str); + return $str; +} +echo translit('тест приветики'); +?> +
+
+
+ +
'; + +//task7 + for($i=0; $i < 10; print $i++){} + +//task8 +echo '
'; +function k() { + $array = array ( + + "Московская область" => array("Москва", "Зеленоград", "Клин" ), + "Тульская область" => array("Тула", "Алексин", "Белев"), + "Ленинградская область" => array("Санкт-Петербург", "Всеволожск", "Павловск", "Кронштадт") + ); + + foreach ($array as $key => $value) { + echo $key . ':
'; + for ($i = 0; $i <= count($value); $i++ ) { + if(substr($value[$i], 0) == 'К') { + + echo $value[$i]. '
'; + echo 'z'; + } + } + echo '

'; + } +} +k(); +echo '

'; + +//task 9 + +function translitReplace($str) { + $arr = array( + 'а' => 'a', + 'б' => 'b', + 'в' => 'v', + 'г' => 'g', + 'д' => 'd', + 'е' => 'e', + 'ж' => 'j', + 'з' => 'z', + 'и' => 'i', + 'к' => 'k', + 'л' => 'l', + 'м' => 'm', + 'н' => 'n', + 'о' => 'o', + 'п' => 'p', + 'р' => 'r', + 'с' => 's', + 'т' => 't', + 'у' => 'y', + 'ф' => 'f', + 'x' => 'kh', + 'ц' => 'ts', + 'ч' => 'ch', + 'ш' => 'sh', + 'щ' => 'shch', + 'ъ' => '“', + 'ы' => 'y', + 'ь' => '‘', + 'э' => 'eh', + 'ю' => 'yu', + 'я' => 'ya' + ); + $str = strtr($str, $arr); + $str = mb_strtolower($str); + $str = mb_ereg_replace('[^-0-9a-z]', '_', $str); + $str = mb_ereg_replace('[-]+', '_', $str); + $str = trim($str, '_'); + return $str; +} + +echo translitReplace('привет мир'); \ No newline at end of file diff --git a/main.php b/main.php index e27ce3b..4c2495f 100644 --- a/main.php +++ b/main.php @@ -4,4 +4,17 @@ * User: denis * Date: 18/02/2019 * Time: 21:55 - */ \ No newline at end of file + */ + +//task 1 + +$a = 5; +$b = 4; + +if($a > 0 && $b > 0) { + echo $a - $b; +} else if ($a < 0 && $b < 0) { + echo $a * $b; +} else { + echo $a + $b; +}