Помогите, пожалуйста?
<?php
Echo "Please enter the first number \n";
$first=fgets(STDIN);
Echo "Please enter a second number \n";
$second=fgets(STDIN);
Echo "Please enter a mathematical operation \n";
...
...
...
...
<?php
Echo "Please enter the first number \n";
$first=fgets(STDIN);
Echo "Please enter a second number \n";
$second=fgets(STDIN);
Echo "Please enter a mathematical operation \n";
...
...
...
...
$operator = trim(fgets(STDIN));
switch ($operator)
{
'+':
....
break;
'-':
....
break;
'*':
....
break;
'/':
....
break;
default:
Echo "Wrong mathematical operation \n";
}
<?php
Echo "Please enter the first number \n";
$first=fgets(STDIN);
Echo "Please enter a second number \n";
$second=fgets(STDIN);
Echo "Please enter a mathematical operation \n";
$operator = trim(fgets(STDIN));
if ($operator="+")
{
$first+$second=$result;
echo "The result is " . $result . "";
}
else if ($operator= "-")
{
$first-$second=$result;
echo "The result is " . $result . "";
}
else if ($operator="*")
{
$first*$second=$result;
echo "The result is " . $result . "";
}
else if ($operator="/")
{
$first/$second=$result;
echo "The result is " . $result . "";
}
else
{
echo "You can only choose -, +, *, or / ";
}
?>