Two other (functional) ways of writing the code:
if($exp>=200){$level = 4;}
if($exp>=400){$level = 5;}
If the Exp is at least 200, the level is set to 4.
After that, if the experience is at least 400, the level gets set to 5.
A little wasteful, though. Else would be nicer, but it still seems wasteful to check to see if $exp is greater or less than 400 twice...
if($exp>=400){$level = 5;
}elseif($exp>=200){$level = 4;
}
If the exp is at least 400, set the level to 4; otherwise (i.e., when the exp is less than 400) if the exp is at least 200, set the level to 4.
The difference between the code immediately above and the original is that every number that is at least 400 is at least 200, so every $exp that might have passed the second test has already passed and been dealt with by the first. But there are numbers that are at least 200 that are not at least 400 (300, for example); these would fail the first test and are therefore checked against the second test.
Any of these three solutions would work. If they "don't", the problem is elsewhere.