PDA

View Full Version : how does % work?



megahard
Fri 9th Nov '01, 3:18pm
ive seen it like $i%10 or wotever

wot function can this be used with?

Mark Hensler
Fri 9th Nov '01, 4:17pm
That's $i modulus 10. It's a math operator that returns the value of $i divided by 10.

PHP docs: Arithmetic Operators (http://www.php.net/manual/en/language.operators.php)

megahard
Fri 9th Nov '01, 4:35pm
thanks

Billy
Sun 11th Nov '01, 9:22pm
Don't you mean it returns the remainder of $i divided by 10?

Mark Hensler
Mon 12th Nov '01, 5:13am
Yes, it's remainder.

I blame late night dislexia. =P That stuff is bound to happen when your working at 2AM.

I NEED SOME SANITY SLEEP!! :(

Steviepowers
Mon 12th Nov '01, 2:51pm
seen as how we are on the subject of what things mean, what does this do?

$days = (time()-$user[joindate])/86400;
$userexp = round(pow(((pow(($user[posts]*2),3))*($days)),0.5));
$userlevel = 1 + round(pow($userexp,(1 / 3.5)));

I got this from the hacks forum ages ago and I've been trying to develope and EXP to next level code, but I just can't do it