Write a function that computes the result of the four operations

 

PHP implementation:

1

94}

 

This implementation uses two stacks, one for storing numbers and one for storing operators, which recursively enter parentheses after encountering parentheses. The implementation is somewhat clumsy, and the algorithm implementation of “inverse Polish expressions” is supplemented.