Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
User | Post |
OmnipotentEntity Posts: 1/3 |
php does have the eval() function, which will do that, but you need to make extra sure to taint check before you run it. |
Juggling Joker Posts: 7/225 |
Is there a standard PHP function that will evaluate a string as a math function. What I mean, in case I wasn't clear, is this. Say you have "2+3" stored in a string. Is there a function you can run that string through that will return 5?
As always, thanks for the help. Note: While I am willing (and able) to write the necessary functions myself if necessary, I'd much prefer not to if I can avoid it. Edit: No rush now, I did manage to write my own basic math simplifier. It follows the same basic steps a human would (PEMDAS, left to right ordering). I love regular expressions. |