C ckevin New Member Oct 6, 2002 #1 I have some variables in php and want to display the results with signs ( + or - ) E.g. PHP: $c = $a + $b ; echo $c ; $c would be any numbers with a + or - sign. E.g. -6 or +7, however, how can I add the + sign when the result is positive? Thanks!
I have some variables in php and want to display the results with signs ( + or - ) E.g. PHP: $c = $a + $b ; echo $c ; $c would be any numbers with a + or - sign. E.g. -6 or +7, however, how can I add the + sign when the result is positive? Thanks!
hohoho New Member Oct 6, 2002 #2 the easiest way is if($c>0) $c = "+".$c; negative numbers get a - automaticcaly, i think Last edited: Oct 6, 2002
C ckevin New Member Oct 6, 2002 #3 hohoho, thank you, it works! I seached PHP website and I find no answer, and your solution save me much time!
hohoho, thank you, it works! I seached PHP website and I find no answer, and your solution save me much time!