Wut? This simply assigns $dada the new value of $num1 which is equal to the negative value of $num2 added to $num1. This still is a number and will not show the sign unless its negative. This will also adjust the value of $num1.
Did you read the link provided? Use a print formatter to keep it as a number and add a sign:
Wut? This simply assigns $dada the new value of $num1 which is equal to the negative value of $num2 added to $num1. This still is a number and will not show the sign unless its negative. This will also adjust the value of $num1.
Did you read the link provided? Use a print formatter to keep it as a number and add a sign:
PHP Code:
$var = 15;
printf('%+d', $var);
Will show +15.
Ok I got it, the problem I had was I needed to put that into a variable.
It seems to work, but if anyone sees something wrong anyway
please let me know.
If you are straight out printing it, just use a printf:
PHP Code:
printf('<td>%+d</td>', $var);
Much faster.
You may have wanted to store it as a string for later uses. Not really necessary since printf is a construct so you'll see almost no performance loss by using it.
Edit:
Actually, printf is not considered a construct; how odd. Still, I can't see tremendous overhead in its use.