php, if else not working

Associate
Joined
11 Oct 2008
Posts
268
Im trying to make an if else code that does the following

if experience points is less than 1000 echo 'level 1'

if experience points is greater than 3000 and less than 8000 echo 'level 2'

if experience points is greater than 8000 and less than 16000 echo 'level 3'

if experience points is greater than 16000 and less than 25000 echo 'level 4'

I have the following code but it does nothing, doesnt output anything or give any errors. Can anyone see what I have done wrong?

PHP:
<?php

if ($exp < 1000) {

  echo '1';

} elseif (($exp > 3000) && ($exp < 8000)) {

  echo '2';

} elseif (($exp > 8000) && ($exp < 16000)) {

echo '3';

} elseif (($exp > 16000) && ($exp < 25000)) {

echo '4';

}
?>
 
Back
Top Bottom