Connecting Tech Pros Worldwide Forums | Help | Site Map

numerical evaluation of a string

geantbrun
Guest
 
Posts: n/a
#1: Dec 11 '07
Hi,
is there a way to evaluate in PHP a string like "2+3*5" ? I'm
expecting 17 as a result. A way to achieve that would be to invoke the
bc calculator but I was wondering if you can do such a thing directly
in PHP?
Cheers,
Patrick

Michael Fesser
Guest
 
Posts: n/a
#2: Dec 11 '07

re: numerical evaluation of a string


..oO(geantbrun)
Quote:
>is there a way to evaluate in PHP a string like "2+3*5" ? I'm
>expecting 17 as a result. A way to achieve that would be to invoke the
>bc calculator but I was wondering if you can do such a thing directly
>in PHP?
eval()

Micha
Closed Thread