This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', '1'); | |
//В переменной $day лежит какое-то число из интервала от 1 до 31. Определите в какую декаду месяца попадает это число (в первую, вторую или третью). | |
$day = 15; | |
if ($day < 11) { | |
echo "Первая декада"; | |
} elseif ($day > 10 && $day < 21) { | |
echo "Вторая декада"; | |
} elseif ($day > 20 && $day < 32){ | |
echo "Третья декада"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Создайте переменную $a и присвойте ей значение 3. Выведите значение этой переменной на экран. | |
$a = 3; | |
echo $a; | |
?> | |
<br> | |
<?php | |
//Создайте переменные $a=10 и $b=2. Выведите на экран их сумму, разность, произведение и частное (результат деления). | |
$a = 10; | |
$b = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); | |
//0) Дан массив с элементами 1, 2, 3, 4, 5. С помощью цикла foreach найдите сумму квадратов элементов этого массива. Результат запишите переменную $result | |
$arr = [1, 2, 3, 4, 5]; | |
$result = 0; | |
foreach ($arr as $value) { | |
$result += pow($value, 2); | |
}; | |
echo $result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); | |
//Преобразуйте строку 'var_test_text' в 'varTestText'. Скрипт, конечно же, должен работать с любыми аналогичными строками. | |
$text = 'var_test_text'; | |
function transformation($str) { | |
$arr = explode('_', $str); | |
$exitStr = ''; | |
foreach ($arr as $key => $value) { | |
if ($key != 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); | |
//Работа с регистром символов | |
//Для решения задач данного блока вам понадобятся следующие функции: strtolower, strtoupper, ucfirst, lcfirst, ucwords. Дана строка 'php'. Сделайте из нее строку 'PHP'. | |
$str = 'php'; | |
echo strtoupper($str); | |
?> | |
<br> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<style type="text/css"> | |
.red { | |
outline: 2px solid red; | |
} | |
.hidden { | |
display: none; | |
} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Спросите у пользователя имя с помощью формы. Сделайте чекбокс: если он отмечен, то поприветствуйте пользователя, если не отмечен - попрощайтесь с пользователем. | |
Спросите у пользователя бывал ли он в Италии c помощью двух radio-кнопок. Выведите результат на экран. Сделайте так, чтобы по умолчанию один из вариантов был уже отмечен. | |
Спросите у пользователя его образование с помощью нескольких radio-кнопок. Варианты ответа сделайте такими: среднее, высшее, незаконченное высшее | |
Спросите у пользователя его образование с помощью выпадающего списка. Варианты ответа сделайте такими: среднее, высшее, незаконченное высшее | |
Спросите у пользователя его пол используя выпадающий список. --> | |
<h1>idex.php</h1> | |
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>index.php</h1> | |
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); | |
?> | |
<p>1. Создайте форму загрузки файлов на сервер. Принимайте отправляемых файл и перемещайте в место хранения.</p> | |
<form action="server.php" method="POST" enctype="multipart/form-data"> | |
<input type="file" name="file" > | |
<p><input type="submit" name="sendFirst"></p> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*ООП | |
1.Сделайте класс Worker, в котором будут следующие public поля - name (имя), age (возраст), salary (зарплата). | |
2.Создайте объект этого класса, затем установите поля в следующие значения (не в __construct, а для созданного объекта) - имя 'Иван', возраст 25, зарплата 1000. Создайте второй объект этого класса, установите поля в следующие значения - имя 'Вася', возраст 26, зарплата 2000. | |
3.Выведите на экран сумму зарплат Ивана и Васи. Выведите на экран сумму возрастов Ивана и Васи. */ | |
class PublicWorker { | |
public $name; | |
public $age; | |
public $salary; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Функции | |
1.Сделайте функцию, которая возвращает квадрат числа. Число передается параметром. | |
2.Сделайте функцию, которая возвращает сумму двух чисел. Числа передаются параметрами функции. | |
3.Сделайте функцию, которая отнимает от первого числа второе и делит на третье. | |
4.Сделайте функцию, которая принимает параметром число от 1 до 7, а возвращает день недели на русском языке. --> | |
<?php | |
ini_set('display_errors', '1'); | |
error_reporting(E_ALL); | |
function square($num = 0) { | |
return pow($num, 2); |
OlderNewer