Go Back   HTMLCenter Web Development Forums > Web Design and Development > Programming and Scripting

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-22-2008, 08:04 PM
Registered User
 
Join Date: Jul 2004
Posts: 224
how to avoid multiples of 10?

I need to express:
PHP Code:
if($i!=){ 
$i shouldn't be a multiple of 10.
Reply With Quote

  #2 (permalink)  
Old 07-23-2008, 05:24 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,399
That's what the modulus operator (%) is for. The modulus divides the first number by the second number and returns only the remainder. Therefore, your statement should look like:
PHP Code:
if($i%10 !== 0) { 
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid Fuzzy images* Urgent! Secret_peace Graphics and Flash 5 04-19-2005 01:08 PM


All times are GMT -5. The time now is 11:00 PM.

 
KickApps
Clicky Web Analytics


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter