If PHP implements a custom formula, such as a question, it uses PHP to save the user-defined formula ($ a + $ B * 2-3 * $ c) to the mysql table, then, when the calculation is required, the formula is read from the table. However, after the formula is read, it cannot be used and is treated as a string. how can this problem be solved, the variable has been pre-configured before the formula is read. if you implement the custom formula
For example, you have used PHP to save the user-defined formula ($ a + $ B * 2-3 * $ c) to the mysql table, the formula is read from the table, but it cannot be used after it is read. it is treated as a string. how can this problem be solved? the variable has been pre-configured before the formula is read?
Share: More
------ Solution --------------------
Try the eval () function.
------ Solution --------------------
Https://github.com/droptable/php-shunting-yard.git
------ Solution --------------------
Reference:
Quote: reference:
Https://github.com/droptable/php-shunting-yard.git
What is this? Can you make it clear?
You can see his explanation. it's an expression parser.
Generally, you can use the eval function.
If you are afraid of eval, you can also write it in the create_function parameter.
------ Solution --------------------
The eval reminds me of a Trojan horse.