I am trying to make a math game where two numbers are generated and are either added or subtracted from each other every time u type the answer. i can get the numbers to display but i cant get the operator to display. how would i do that? here is my code:
php
<?php
$num1 = rand(0, 20);
$num2 = rand(0, 20);
$operators = array(
"+",
"-",
);
switch ($operators[array_rand($operators)]) {
case "+":
$result = $num1 + $num2;
break;
case "-":
$result = $num1 - $num2;
break;
}
echo'
<div class="row">
<div class="col-md-3 col-md-offset-1">'. $num1 .'</div>
<div class="col-md-3 col-md-offset-1">'. $operators .'</div>
<div class="col-md-3 col-md-offset-1">'. $num2 .'</div>
</div>
'
?>