вот сколько лепестков у розы: " . $numpetals; function printgreeting() { global $guess, $numpetals; $guess = $_POST["guess"]; $numpetals = $_POST["numpetals"]; //эначения из скрытых полей для вывода предыдущей картинки $d1 = $_POST["dice1"]; $d2 = $_POST["dice2"]; $d3 = $_POST["dice3"]; $d4 = $_POST["dice4"]; $d5 = $_POST["dice5"]; if (is_numeric($guess) == FALSE and strlen($guess) != 0) { print <<вы ввели не числовое значение! HERE; } else { if (strlen($guess) == 0) { print <<Добро пожаловать в игру "Сколько лепестков у розы?" HERE; } else if ($guess == $numpetals) { print <<Поздравляем! Вы правы! Количество лепестков розы равно $numpetals!!!

Ваш предыдущий бросок:


HERE; showdice($d1); showdice($d2); showdice($d3); showdice($d4); showdice($d5); } else { print <<Ваше предположение НЕВЕРНО.
Вы ввели число $guess. На самом деле лепестков у розы: $numpetals

Ваш предыдущий бросок:


HERE; showdice($d1); showdice($d2); showdice($d3); showdice($d4); showdice($d5); } } } function printdice() { global $numpetals, $dice1, $dice2, $dice3, $dice4, $dice5; print"

Новый бросок:

"; $numpetals = 0; $dice1 = rand(1, 6); $dice2 = rand(1, 6); $dice3 = rand(1, 6); $dice4 = rand(1, 6); $dice5 = rand(1, 6); showdice($dice1); showdice($dice2); showdice($dice3); showdice($dice4); showdice($dice5); print "
"; calcnumpetals($dice1); calcnumpetals($dice2); calcnumpetals($dice3); calcnumpetals($dice4); calcnumpetals($dice5); print"

Сколько лепестков у розы? Введите числовое значение:

"; } function showdice($value) { print << HERE; } function calcnumpetals($value) { global $numpetals; switch ($value) { case 3: $numpetals = $numpetals + 2; break; case 5: $numpetals +=4; break; } } function printform() { global $numpetals, $dice1, $dice2, $dice3, $dice4, $dice5; print << HERE; } ?>