is there a quick php command for making a number negative?
i.e. from 25.23 to -25.23 ?
Thanks
$num = 0 - $num;
thanks i know i can do that, i was just wondering if there was anything built in to php !!
Thanks anyway!
It's called simple fricking arithmetic... multiply by -1 or subtract from 0, it woudl be utterly pointless to make a function just to turn a number negative.
excellent ,thanks for making me laugh there superwormy ,some people do ask for it though , i mean really
paul
Originally posted by superwormy It's called simple fricking arithmetic... multiply by -1 or subtract from 0, it woudl be utterly pointless to make a function just to turn a number negative.
Unless it also checked to make sure a number as negative before acting like ABS does for positives. However this is very simple
function NBS($num) { if ($num > 0) { return $num * -1;} return $num }