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-set before the formula is read.
Reply to discussion (solution)
Try the eval () function.
You can use this function using eval (). Is there any other method?
Https://github.com/droptable/php-shunting-yard.git
Https://github.com/droptable/php-shunting-yard.git what is this? Can you make it clear?
Directly use the eval () function.
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.
The eval reminds me of a Trojan horse.