Solving equations can have many applications, like for instance, drawing charts that represent the curves defined by assigning values of given ranges to the variables of the equations.
The PHP eval() function can be used to dynamically evaluate the expressions defined by an equation. However, it may be dangerous to evaluate an arbitrary expression provided by an user, as it may contain malicious code.
This class provides an alternative solution that consists in a full expressions parser and evaluator that only supports a limited set of operations that do not represent a security risk when the operations are evaluated.
This class solves equations with multiple variables.
It does not resort to the PHP eval() function to help prevent security risks of using malicious expression values for instance with a calculator that takes expressions defined by the users.
It comes with a sub-class that can produce graphic charts plotting the curve defined by the equation expression withing a given range of x and y values. The generate chart graphics can be outputted in the PNG or JPEG formats using the GD library.