"but php realized that I clicked a plus ..." I am afraid that here I must understand not PHP, but you must understand how the interaction between the client and server parts of the application occurs.
The PHP script will accept the variable (with the sign of addition, subtraction, etc.) and if it doesn’t have further instructions, it will cheerfully and easily complete its work, forgetting everything that was passed to it. Accordingly, it is necessary to either save this variable somehow (session, database, etc.), or send it back to the user on the screen and take it into account when re-requesting.
How to determine that it was pressed "PLUS", and not the calculation of the result, it is simple:
<form action="test.php" method="POST"> ... <p><input type="submit" name="action" value="+"></p> <p><input type="submit" name="action" value="-"></p> <p><input type="submit" name="action" value="рассчитать"></p> ... </form>
A form can contain several buttons of the "submit" type, and when a certain button is clicked, it will transmit exactly its value. That is, if the "+" button is pressed in this form, in the "test.php" script the value of $ _REQUEST ['action'] will be equal to "+"; if the button "calculate" is pressed - $ _REQUEST ['action'] will be equal to "calculate", etc.
Well, how to understand what kind of action I was told. The rest yourself.
Criticism of the answer welcome.
And this is all under the condition, if at all, there is a need to notify the server in advance about the upcoming manipulations with numbers. Otherwise, the sign can be substituted with js in a hidden field and sent to the server directly when you click the "calculate" button.