By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,852 Members | 1,410 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,852 IT Pros & Developers. It's quick & easy.

Finding difference

P: 36
Hi
i just need to find the difference between to numbers .
if i subtract i am getting the minus symbol,i just want the difference of two numbers .

your help will be appreciated

thanking you in advance
Apr 18 '08 #1
Share this Question
Share on Google+
1 Reply


nithinpes
Expert 100+
P: 410
Hi
i just need to find the difference between to numbers .
if i subtract i am getting the minus symbol,i just want the difference of two numbers .

your help will be appreciated

thanking you in advance

All you need to do is to use abs() function to get the absolute value.

For ex:
Expand|Select|Wrap|Line Numbers
  1. $a = 5;
  2. $b = 12;
  3. $c= abs($a-$b);
  4. print "Difference: $c \n";  ## will print Difference: 7
  5.  
  6.  
Apr 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.