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
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Sun Feb 29, 2004 11:13 am
How would I do this? I kept getting parse errors. I tried this.
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Sun Feb 29, 2004 11:23 am
What is it that you want to do? Print out the solution?
If so, assuming that both $wins and $losses have been declared, and $losses is not zero than you can print the solution by doing:
Dr Evil
Forum Contributor
Posts: 184 Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland
Post
by Dr Evil » Sun Feb 29, 2004 11:35 am
You could try:
Code: Select all
<?php
if ($losses>'0'){
$result = $wins / $losses * 100;
}
else{
$result = "Can not be calculated!";
}
echo $result;
?>
If you are trying to get the percentage of losses, you have to take the total amount of games:
Code: Select all
<?php
if (($losses+$wins)>'0'){
$result = $wins / ($wins+$losses) * 100;
}
else{
$result = "Can not be calculated!";
}
echo $result;
?>
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Sun Feb 29, 2004 4:39 pm
Hey havoc, you make that signature up? Definitely something that people could spend many hours thinking about
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Sun Feb 29, 2004 5:43 pm
It's the same thing as "The above statement is true" and a few others
a real mind boggler tho
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Sun Feb 29, 2004 6:53 pm
The signature is a riddle. I haven't found the real answer for it. But I made up my own. It drove me insane. So the answer to the riddle in my opinion is insanity. Btw, Thanks a bunch Dr.Evil
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Sun Feb 29, 2004 6:57 pm
haha.. your sig reminds me of politicians..
which one to believe.. hmm..
toms100
Forum Contributor
Posts: 119 Joined: Wed Feb 26, 2003 10:29 am
Location: Bristol,UK
Post
by toms100 » Mon Mar 01, 2004 1:43 am
hehe, the ultimate paradox, "this statement is false"
nigma
DevNet Resident
Posts: 1094 Joined: Sat Jan 25, 2003 1:49 am
Post
by nigma » Mon Mar 01, 2004 6:43 pm
It's not the wording of the statement but the message it conveys, whether it's "the statement below is true" or "the line below is true" is of no importance.
A real mind boggler