Jump to content


Photo

Change sign on numeric value


  • Please log in to reply
2 replies to this topic

#1 ghgarcia

ghgarcia
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts
  • LocationFlorida

Posted 28 August 2006 - 10:23 PM

I need some help in changing a positive to a negative and vica as versa. Any help would be greatly appreciated.

Thanks,
George
George

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 28 August 2006 - 10:26 PM

Multiply by -1.

$x = 10;
echo 'x = ' . $x . "<br>-x = ' . $x * -1;
$y = -20;
echo 'y = ' . $y . "<br>-y = ' . $y * -1;



#3 ghgarcia

ghgarcia
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts
  • LocationFlorida

Posted 28 August 2006 - 10:30 PM

Thanks really appreciate it works great.

George
George




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users