Finding difference

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jain236
    New Member
    • Jul 2007
    • 36

    Finding difference

    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
  • nithinpes
    Recognized Expert Contributor
    • Dec 2007
    • 410

    #2
    Originally posted by jain236
    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:
    Code:
    $a = 5;
    $b = 12;
    $c= abs($a-$b);
    print "Difference: $c \n";  ## will print Difference: 7

    Comment

    Working...