I am trying to make an application that can solve or isolate an equation. I'm not really sure which language I should proceed with, and I am looking for ideas and suggestions.

By solving, I mean: Let's say we have an equation A=B*C.. and we want to find C.. and we do that by dividing B on both sides. And this is basically the task I want to perform, only the amount of variables and operators will vary, since the equation will be given to the application by the user in form of a string.

I have only tried using PHP for this task so far, but I am stuck, and I haven't found any library or api or guides that I can use without having to pay more than I can afford for it. And as it seems, it's so tricky, there are so many things to consider... like: The rules for solving the equation, the number of variables in the equation, the priority of the operators while solving the variables and so on...

So basically, what I am asking, is: what would be the most preferred language for this task, and why?