title: Check Empty and zero on PHP
body: <p>I want to add subtract and other function from user data in PHP. At first, I want to check the field is empty or not.When I check empty using <code>empty()</code> function and I submit zero then it shows required that means it is empty.How can I input zero and it add or subtract with my second value?Thank you.My code is here</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  if ($_SERVER['REQUEST_METHOD']=='POST'){
      $num1=$_POST['num1'];
      $num2=$_POST['num2'];
      if (empty($num1 AND $num2)){
          echo "Required";
      }else{
      if ($_POST['submit']=='Add'){
          $num1=$_POST['num1'];
          $num2=$_POST['num2'];
          $add=$num1+$num2;
          echo $add;
      }
      elseif ($_POST['submit']=='Subtract'){
          $subtract=$num1-$num2;
          echo $subtract;
      }
      elseif ($_POST['submit']=='Multiplication'){
          $multiply=$num1*$num2;
          echo $multiply;
      }
      elseif ($_POST['submit']=='Division'){
          $division=$num1/$num2;
          echo $division;
      }
  
      }
  }
  ?&gt;
  
  &lt;form action="" method="post"&gt;
      &lt;input type="number" name="num1"&gt;
      &lt;input type="number" name="num2"&gt;
      &lt;input type="submit" name="submit" value="Add"&gt;
      &lt;input type="submit" name="submit" value="Subtract"&gt;
      &lt;input type="submit" name="submit" value="Multiplication"&gt;
      &lt;input type="submit" name="submit" value="Division"&gt;
  &lt;/form&gt; 
  
  &lt;/body&gt;
  &lt;/html
  </code></pre>