In PHP, I can do this:
$value1 = 5;
$value2 = -2;
echo $value1 + $value2; // 3
But how would I do this with multiplication or division? Something like:
$value1 = 10;
$value2 = /2;
echo $value1 (?) $value2; // 5;
How would I manage this situation as simply as possible?
If you only need to differentiate between division and multiplication,
Your code works with addition and subtraction, because
-2in$value2 = -2;does not mean “subtract two”. It means “[add] minus two”. For multiplication, you need “two” or “the inverse of two”