开发者

Is there any PHP or JavaScript math expression formatters (which adds brackets)?

Google Calculator formats math expressions this way:

2+2/2 ---> 2 + (2 / 2)
2+2/2*PI ---> 2 + ((2 / 2) * PI)

In others words - it adds brackets. Are there any similar PHP or Ja开发者_Python百科vaScript solutions to do the same thing?


Yes; quickest and easiest way to not code it yourself (like how Google did) is to use MathML.

Hope this helps!


surely you could just query the calendar via curl + ajax / postback? the result is a json array with left, right, error etc.

query example: http://www.google.com/ig/calculator?q=5*9%2B%28sqrt+10%29^3%3D

php / curl sample: http://www.dynamicguru.com/php/currency-conversion-using-php-and-google-calculator-api/#more-285

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜