PHP Classes

PHP Arithmetic Operations: Perform calculations with values passed as strings

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 99 All time: 9,818 This week: 206Up
Version License PHP version Categories
php-arithmetic-class 1.0MIT/X Consortium ...5PHP 5, Math, Parsers
Description 

Author

This class perform calculations with values passed as strings.

It takes as parameters a string with number values separated by commas.

The class can parse the string to extract the values and performs several types of arithmetic operations like addition, subtraction, multiplication, division and average.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 23
All time rank: 84310 in Pakistan Pakistan
Week rank: 44 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php

require_once 'classes/Arithmetic.php';

$add = '10,20,-30,40,50,60';
$mul = '2,2,5,10';
$sub = '20,10';
$div = '1000,20,5,2';
$avg = '10,20,30,40,50,60';
$addition = Arithmetic::Calculate($add, 'addition');
$multiplication = Arithmetic::Calculate($mul, 'multiplication');
$substraction = Arithmetic::Calculate($sub, 'substraction');
$divisin = Arithmetic::Calculate($div, 'division');
$average = Arithmetic::Calculate($avg, 'average');

echo
'Addition: '.$addition;
echo
'<br>';
echo
'multiplication: '.$multiplication;
echo
'<br>';
echo
'Substraction: '.$substraction;
echo
'<br>';
echo
'divisin: '.$divisin;
echo
'<br>';
echo
'average: '.$average;


Details

PHP Arithmetic class

This class can perform arithmetic operations such as addition , division etc

Feature

It can perform.

1. Addition 2. Substraction 3. Multiplication 4. Division 5. Average


  Files folder image Files (4)  
File Role Description
Files folder imageclasses (1 file)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Readme.md Doc. Documentation

  Files folder image Files (4)  /  classes  
File Role Description
  Plain text file Arithmetic.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:99
This week:0
All time:9,818
This week:206Up