Using phpEquations class

Following is an example illustrating use of phpEquations:

<?php

//Include phpequations class:
include_once("phpequations.php");

//Declare an object
$obj = new phpequations; 

//Call to solve equations
$solution = $obj->solve("
	a+b+2*c=5
	a-b = u
	u-2*a=4
	2*b=a
");

//Print results
print_r($solution);

?>

Output:

Array
(
    [a] => -2.6667
    [b] => -1.3333
    [c] => 4.5
    [u] => -1.3333
)

Click here to see live demonstration of phpEquations.