Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Arithmetic Array (PHP)

Using the mathematical operation between two arrays with the same key

Utilizando operação matemática entre dois arrays com a mesma chave

Example

include_once "ArithmeticArray.php";
$op = new ArithmeticArray();

$a = ['y'=>10,'x'=>9.50];
$b = ['y'=>3,'x'=>3];

// numeric values are rounded
print_r($op->operation($a,$b,'+')); // result = ['y'=>13 'x'=>12.5]
print_r($op->operation($a,$b,'-')); // result = ['y'=>7 'x'=>6.5]
print_r($op->operation($a,$b,'*')); // result = ['y'=>30 'x'=>28.5]
print_r($op->operation($a,$b,'/')); // result = ['y'=>3.33 'x'=>3.17]

About

Using the mathematical operation between two arrays with the same key. Utilizando operação matemática entre dois arrays com a mesma chave

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages