0

Result of calculations.

For example somebody write on site into input 2+2 and then variable goes to php by GET. Php print variable as 2+2. How to automatically convert it to result of given calculation (4)?

9th Jun 2017, 7:09 PM
Jakub Korytko
Jakub Korytko - avatar
1 Odpowiedź
0
You can use eval () function but with this function is dangerous so you must test the content of your $_GET with a regexp testing a pattern allowing only numbers whitespace braces and mathematic operators.
10th Jun 2017, 8:51 PM
Yohann PARISIEN
Yohann PARISIEN - avatar