Jump to content

Recommended Posts

I'm parsing the text and fill an array.

So for example I got the string x+12*(12+1)

Now I replace the variables with numbers and then I fill the array like that:

[0] => x
[1] => +
[2] => 12
[3] => *
[4] => (
[5] => 12
[6] => +
[7] => 1
[8] => )

Then I'm looking for the brackets and send the content for an extra calculation.

Then there comes the rest: so multiplications and additions.

 

For calculating I use the bcmath-functions (http://www.php.net/manual/en/ref.bc.php)

Link to comment
https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-279952
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.