Here is the script, writes the error expected #EOF

error_reporting (-1); $anonDice1 = mt_rand(1,6); $compDice1 = mt_rand(1,6); $anonDice2 = mt_rand(1,6); $compDice2 = mt_rand(1,6); echo "У анона выпало {$anonDice1} и {$anonDice2}\nУ компьютера выпало {$compDice1} и {$compDice2}\n"; $anonSum - ($anonDice1 + $anonDice2); $compSum - ($compDice1 + $compDice2); if (($anonDice1 == $anonDice2) && ($compDice1 == $compDice2)); { echo "2 дабла - невероятная удача."; } elseif ($anonSum > $compSum); { echo "Анон победил !"; } elseif ($anonSum < $compSum); { echo "Компьютер Победил!"; } else ($anonSum == $compSum); { echo "Ничья :("; } exit(); 

Closed due to the fact that off-topic participants Visman , aleksandr barakin , Kromster , artoodetoo , Alexander Soloshenko 3 Sep '15 at 1:31 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Visman, aleksandr barakin, artoodetoo
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • it will be more convenient to look here ideone.com/Wl3Y9D - Artem Shestakov
  • Is it really so hard to format the code yourself? - Dmitriy Simushev

1 answer 1

You have extra characters ; in blocks of conditions. In addition, the else block must not contain conditions. The working code might look something like this:

 error_reporting (-1); $anonDice1 = mt_rand(1,6); $compDice1 = mt_rand(1,6); $anonDice2 = mt_rand(1,6); $compDice2 = mt_rand(1,6); echo "У анона выпало {$anonDice1} и {$anonDice2}\nУ компьютера выпало {$compDice1} и {$compDice2}\n"; // Эти строки скорее всего делают не то, что вам кажется... $anonSum - ($anonDice1 + $anonDice2); $compSum - ($compDice1 + $compDice2); if (($anonDice1 == $anonDice2) && ($compDice1 == $compDice2)) { echo "2 дабла - невероятная удача."; } elseif ($anonSum > $compSum) { echo "Анон победил !"; } elseif ($anonSum < $compSum) { echo "Компьютер Победил!"; } else { echo "Ничья :("; } exit(); 

From how the if/elseif/else structures should look like: http://php.net/manual/ru/control-structures.elseif.php