How to make a math operation in php like calculator? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0
29th Jul 2018, 9:31 AM
Ade Irwan
Ade Irwan - avatar
1 Réponse
+ 15
You can use something like this: $input = '2+5'; $result = eval('return ' . $input . ';'); echo $result;
29th Jul 2018, 9:51 AM
Igor Makarsky
Igor Makarsky - avatar