(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
09-22-24 05:36 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - PHP String Question New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
Juggling Joker

Ninji

SMW Mod
Merry Christmas!



 





Since: 11-18-05

Last post: 6453 days
Last view: 6425 days
Posted on 12-02-05 03:27 PM Link | Quote
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.


(edited by Juggling Joker on 12-02-05 04:15 PM)
(edited by Juggling Joker on 12-02-05 06:30 PM)
OmnipotentEntity
Newcomer


 





Since: 12-03-05

Last post: 6618 days
Last view: 6618 days
Posted on 12-03-05 01:52 AM Link | Quote
php does have the eval() function, which will do that, but you need to make extra sure to taint check before you run it.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - PHP String Question |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.008 seconds; used 353.91 kB (max 411.11 kB)