why isnt this value rounding off?

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

Post Reply
Mythic Fr0st
Forum Contributor
Posts: 137
Joined: Sat Dec 02, 2006 3:23 am
Contact:

why isnt this value rounding off?

Post by Mythic Fr0st »

Im trying to round a value off

this is my code

$_SESSION['strdmg']==rand(0, $_SESSION['strdmg'] * 2);

(above generates a random number between 0 & strdmg * 2, which btw is always 1.8)
(below is suppost to round it off, so it'd be 2.0 (i cant have decimal damage in my game, nor do I want it))

$_SESSION['strdmg']==round($_SESSION['strdmg']);

any idea's o_O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're mixing comparison operators and assignment operators again...

= is assignment (set the left operand to the right operand)
== is equality (the left operand's value is the same as the right operand's)
=== is identity (the types are the same and values are the same)
Mythic Fr0st
Forum Contributor
Posts: 137
Joined: Sat Dec 02, 2006 3:23 am
Contact:

lol

Post by Mythic Fr0st »

ah thanks, -.- im tired and very brain fogged today
Post Reply