I have a project where I calculate statistics of various fields and display them in tables. Now since this project is meant for 1 company I want to make it generic so that it can be used by others as well.
For example, I want to have a function that takes pattern as parameter and array of values and then calculates based on that pattern, for example:
$pattern = 'a-b*c';
$a = 5;
$b = 1;
$c = 2;
$values = array($a, $b, $c);
calculateGivenPattern($pattern, $values);
and above would give result:
5 - 1 * 2 = 3
Is such thing possible in PHP? I am not asking for code, just need a name of algorithm or design pattern that will help me design this.
Thanks alot