I am dealing with a problem. I have formulas for various calculations and they all are strings in JSON objects. I need to apply variables from PHP and calculate the value using these formulas. Is there any way of achieving this? For example:
My JSON written formula (string format):
"formulas": [
{
"id": "aag",
"parameter": "",
"exp": "((FiO2*713)-(PaCO2/0.8))-PaO2"
},
{
"id": "naa",
"parameter": "",
"exp": "(age/4)+4"
}
],
So I get the object with PHP and I can access to every element in that object. And I have inputs with variables, that are used in these formulas (FiO2, PaCO2, age and etc.). I need to somehow get this formula as a legit formula and not string ($formula = (($FiO2*713)-($PaCO2/0.8))-$PaO2;). Is it possible? Thanks in advance :)