Jump to content

maths 20%


westman

Recommended Posts

$num2=$num1-($num1/5);

it is just a simple math 20% of $num1 is $num1*20/100 which boils down to above equation (($num1/5);)http://php.net/number_format for formating number

Edited by birbal
Link to comment
Share on other sites

you need substract the 20% of it from the $my_num1 to get it. what are you geting now is 20% of $my_num1

Link to comment
Share on other sites

You shouldn't have quotation marks around the 8. You're forcing the engine to convert from a string to a number before doing the operation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...