0
1.<html>
<head>
<title> health </title>
</head>
<body>
<?php
Echo "you have 5 health" ;
x=5
5-- ; 
5-- ;
Echo "you lost 2 health" ;
echo "You have 3 health left" ;
?>
</body>
</html>

or

2<html>
<head>
<title> health </title>
</head>
<body>
<?php
Echo "you have 5 health" ;
x=5 ;
5-- ; 
5-- ;
Echo "you lost 2 health" ;
echo "You have 3 health left" ;
?>
</body>
</html>

which should it be 1 or 2 or a diffrent 1?

2
Contributors
4
Replies
5
Views
13 Years
Discussion Span
Last Post by Killer_Typo
0

ok i changed this a little

<html>
<head>
<title> health </title>
</head>
<body>
<?php
Echo "you have 5 health" ;
x=5
x-- ; 
x-- ;
Echo "you lost 2 health" ;
echo "You have 3 health left" ;
?>
</body>
</html>

its what the site told me to do it keeps saying error on line 8

0

im not sure what your code i supposed to do?

(also you forgot the $ symbol for you x value, all variables must have a $ symbol to siginify them.)

all it will do is echo a few statements and subtract 1 from 5 twice.

if you wanted to do somthing more meaning full you could write.

$health = 5;
$damage = 2;
//make sure correct damage was taken
echo "you have taken $damage damage<br />";
//echo how much health you should now have after damage was taken.
echo "you now have ";
$second_health = $health - $damage;
echo $second_health;
echo " health"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.