Obviously your table test is wrong. Desktop tests need to simulate what the computer does and not what you want it to do. I do not even know if it is the case of table test, just do the simple mathematical calculation.
Maybe you're talking about the undefined behavior in C that is to change the value of t
in progress in the expression . Take out ++
and give the result you expect. If you need it you need to see where you want to go and put the expression in another way. Never use an operator that causes a side effect on the variable in the middle of an expression.
In PHP it may be different, in another version of C compiler or another platform may be different.
#include <stdio.h>
int main(void) {
int t = 3;
int p = -5;
int q = 1;
int m = (q * p + (t * t) - (t + q)) - 2;
int n = (q * p + (t * ++t) - (t + q)) - 2;
t = 3;
int o = (q * p + (t * t++) - (t + q)) - 2;
printf("%d, %d, %d", m, n, o);
}
See running on ideone . And no Coding Ground . Also put it in GitHub for future reference .