I have an array like this:
$variables = array("fsueldo", "fgratificacion");
$values = array($employee->salary, $employee->gratification);
How you can see $employee->salary is a numeric value and same thing with $employee->gratification so I have str_replace like this one:
$calculation = str_replace($variables, $values, $hr_formula->math);
The variable $hr_formula->math has fsueldo+fgratificacion as value
When I replace... it displays 88000+155000 BUT I do not understand why it does not sum or substract or do the calculation, it displays the replaced values but it does not make the math.. so I wonder why does it not sum in this case? I mean it should display 243000 not 88000+155000.
I forgot to say that the variable $hr_formula->math can be any math calculation I mean it can be fsueldo-fgratificacion or fsueldo*fgratificacion.. so I wonder how can It make the math?
Thanks.