PHP Classes

File: public/Classes/Operationen/Division.php

Recommend this page to a friend!
  Classes of stefan  >  PHP Calculator  >  public/Classes/Operationen/Division.php  >  Download  
File: public/Classes/Operationen/Division.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Calculator
Calculate the result of multiple math operations
Author: By
Last change:
Date: 1 year ago
Size: 377 bytes
 

Contents

Class file image Download
<?php
   
namespace Taschenrechner\Classes\Operationen;

    class
Division extends Operation {
       
//Gibt das Zeichen für die Operation zurück
       
public function getSign() {
            return
"/";
        }
       
        public function
calculate($a, $b=NULL) {
           
//Berechne die Operation
           
if(empty($b))
                throw new \
Exception("Division by Zero");
            return
floatval($a) / floatval($b);
   
        }
    }
?>