PHP Classes

File: public/Classes/Operationen/Addition.php

Recommend this page to a friend!
  Classes of stefan   PHP Calculator   public/Classes/Operationen/Addition.php   Download  
File: public/Classes/Operationen/Addition.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: refactor part2 + add Test and Outcomment a failed test
Date: 2 years ago
Size: 427 bytes
 

Contents

Class file image Download
<?php
   
namespace Taschenrechner\Classes\Operationen;
    class
Addition extends Operation {
       
//Gibt das Zeichen für die Operation zurück
       
public function getSign() {
            return
"+";
        }
       
        public function
calculate($a,$b=NULL) {
           
//Berechne die Operation
            //return floatval(str_replace(',', '.', str_replace('.', '', $a))) + floatval(str_replace(',', '.', str_replace('.', '', $b)));
           
           
return $a + $b;
        }
    }
?>