title: How to create a subtract method in a Math class?
body: <p>I am studying OOP and this is my first study project.</p>
  
  <p>I created a Math class and also created an add method. But when I am trying to create a subtract method I don't know where I am getting a problem. </p>
  
  <p>Please kindly help and give me information where I can get more detailed information on OOP.</p>
  
  <pre><code>&lt;?php
  
  class Math
  {
      /**
       *
       * @return int  
       */
      function add()
      {
          $args = func_num_args();
          $sum = 0;
          $i = 0;
  
          for ( $i; $i &lt; $args; $i++ )
          {
              is_int(func_get_arg($i)) ? $sum += func_get_arg($i) : die('use only integers, please');
          }
          return $sum;
      }
  
      function subtract()
      {
          $args = func_num_args();
          $sub = 0;
          $i = 0;
  
          while($i &lt; $args)
          {
              $sub = func_get_arg($i);
              if (is_int(func_get_arg($i)))
              {
                  is_int($sub - func_get_arg($i));
              }    
          }
          $i++;
          return $sub;
      }
  }
  </code></pre>
  
  <p>I am calling this class in my index.php like this:</p>
  
  <pre><code>&lt;?php
      include("Math.php");
  
          $c = new Math();
          $result = $c-&gt;subtract(100,10,20,45);
  
          echo $result;
  ?&gt;
  </code></pre>