Jump to content

Php Division


westman

Recommended Posts

hi all,am trying to take one number from anther.this is what i have... $number1 = 5;$number2 =2; $number1 = ($number1) - ($number2);$number1 = ($number1 - $number2); this is not working for me. My result is not 3 ie. 5-2=3 how do i do simple division in php?

Link to comment
Share on other sites

??? Thats not division that subtraction, are you echoing out the result? as that should work $number1 = 5;$number2 =2; $number1 = ($number1) - ($number2); echo $number1; Edit: but you may want to use another variable for the end result, as you may which to use the original $number1 value again. $number1 = 5;$number2 =2; $result = ($number1) - ($number2); echo $result;

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...