title: php basic calculator with function and switch but result is
body: <p>i am currently doing some simple calculator for a practice but it the output or result is not showing here is my code guys hope you can help me :/</p>
  
  <pre><code>    &lt;input type="radio" value= "Addition" name="calcu"&gt; Addition .&lt;br /&gt;
      &lt;input type="radio" value= "Subtraction" name="calcu"&gt; Subtraction .&lt;br /&gt;
      &lt;input type="radio" value= "Multiplication" name="calcu"&gt; Multiplication .&lt;br /&gt;
      &lt;input type="radio" value= "Division" name="calcu"&gt; Division .&lt;br /&gt;
  &lt;?php
  $num1 = $_POST['num1'];
  $num2 = $_POST['num2'];
  $calcu = $_POST['calcu'];
  
      function calculate($n1,$n2)
      {
          switch('$calcu')
          {
          case "Addition";
              $compute = $n1 + $n2; 
              break;
          case "Subtraction";
              $compute = $n1 - $n2; 
              break;
          case "Multiplication";
              $compute = $n1 * $n2; 
              break;
          case "Division";
              $compute = $n1 / $n2; 
              break;
          }
      }
  echo "$calcu &lt;br /&gt; &lt;br /&gt; 1st Number: $num1 &lt;br /&gt; 2nd Number: $num2 &lt;br /&gt;&lt;br /&gt;";
  echo "Answer is:" .calculate($num1,$num2);
  ?&gt;
  </code></pre>