PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Fri Jun 24, 2005 7:07 am
Code: Select all
$percent1 = $percent / 100;
$percent1 = $price * $percent1;
when $percent1 = 24.02
and $price = 12
the above expressgives me result zero in $percent1
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jun 24, 2005 8:50 am
Where did you define $price and $percent.... the expression alone is zero if they haven't been defined correctly
Code: Select all
$price = 12;
$percent = 24.02;
$percent1 = $percent / 100;
$percent1 = $price * $percent1;
echo $percent1;
2.8824
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jun 24, 2005 8:52 am
itsmani1 wrote:
when $percent1 = 24.02
Is that a typo? $percent1 is what you are calculating and if that is defined instead of $percent that explains the problem