Jump to content

Archived

This topic is now archived and is closed to further replies.

ghgarcia

Change sign on numeric value

Recommended Posts

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

Thanks,
George

Share this post


Link to post
Share on other sites
Multiply by -1.

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.