Results 1 to 5 of 5

Thread: Basic PHP <> question

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    448

    Resolved Basic PHP <> question

    Lets say I have a variable $number. This variable can equal anything from 1 to 10,000,000

    Now I want to assign $number a level, based on the following incrementation:

    0-999 = Level 1
    1,000-1,999 = Level 2
    2,000 - 9,999 = Level 3
    10,000 - 19,999 = Level 4
    20,000 - 29,999 = Level 5
    30,000 - 39,999 = Level 6
    40,000 - 49,999 = Level 7
    50,000 - 74,999 = Level 8
    75,000 - 99,999 = Level 9
    100,000 - 124,999 = Level 10
    125,000 - 149,999 = Level 11
    150,000 - 199,999 = Level 12
    200,000 - 249,999 = Level 13
    250,000 - 299,999 = Level 14
    300,000 - 349,999 = Level 15
    350,000 - 399,999 = Level 16
    400,000 - 449,999 = Level 17
    450,000 - 499,999 = Level 18
    500,000 - 549,999 = Level 19
    550,000 - 599,999 = Level 20
    600,000 - 649,999 = Level 21
    650,000 - 699,999 = Level 22
    700,000 - 749,999 = Level 23
    750,000 - 799,999 = Level 24
    800,000 - 849,999 = Level 25
    850,000 - 899,999 = Level 26
    900,000 - 949,999 = Level 27
    950,000 - 999,999 = Level 28
    etc. etc. etc
    etc. etc .etc


    Is there any easy way of doing this, so as to not repeat an If statement over and over again?

    Thanks.
    Last edited by k0zz; Aug 6th, 2009 at 04:52 PM.
    "Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width