thefollower Posted July 21, 2008 Share Posted July 21, 2008 I was wondering what function is best to use for converting a negative number to positive? So $Var = -400 would become $Var = 400. Im guessing theres 2 ways it can be done, removing the first char... or perhaps theres a function designed to change negative to positive. What function would i use ? Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted July 21, 2008 Share Posted July 21, 2008 ( $var * -1 ) Quote Link to comment Share on other sites More sharing options...
Jabop Posted July 21, 2008 Share Posted July 21, 2008 http://us.php.net/abs Quote Link to comment Share on other sites More sharing options...
marcus Posted July 21, 2008 Share Posted July 21, 2008 $var = -400; $pos = abs($var); get the absolute value Quote Link to comment Share on other sites More sharing options...
thefollower Posted July 21, 2008 Author Share Posted July 21, 2008 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.