You can simplify it quite a lot once you realise that if $XXmin is not <= 3 then it must be >=4 (assuming that $XXmin is an integer).
if ($XXmin <= 3){$ratingmin = "Very Soft";}
elseif ($XXmin <= 8){$ratingmin = "Soft";}
elseif ($XXmin <= 12){$ratingmin = "Medium Hard";}
elseif ($XXmin <= 18){$ratingmin = "Hard";}
else {$ratingmin = "Very Hard";}
Then you can look at using an array to store the thresholds.
$rating_thresholds = array(3=>'Very Soft',8=>'Soft',12=>'Medium Hard',18=>'Hard'/*,19=>'Very Hard'*/); // We don't actually need the last one
$rating = 'Very Hard'; // We'll assume this unless we discover otherwise
foreach($rating_thresholds as $threshold=>$rating)
{
if($XXmin<=$threshold)
{
$ratingmin = $rating;
break;
}
}
And of course the same code could be used twice - either by making $XXmin and $XXmax into an array, and $ratingmin and $ratingmax into another array; or just by putting that code in a function and calling it.
function XX_to_rating($xx)
{
$rating_thresholds = array(3=>'Very Soft',8=>'Soft',12=>'Medium Hard',18=>'Hard'/*,19=>'Very Hard'*/); // We don't actually need the last one
foreach($rating_thresholds as $threshold=>$rating)
{
if($xx<=$threshold)
{
return $rating;
}
}
return 'Very Hard';
}
$ratingmin = XX_to_rating($XXmin);
$ratingmax = XX_to_rating($XXmax);
And, incidentally, that is a pretty dumb subject line you have there. Of the words you use, "I" is redundant, "help" is redundant, "code" is redundant, and "need" is only to be expected. The second "!" is redundant, and the first "!" is pretty much implied by the use of the word "need". That leaves "with" as your entire subject, which is totally content-free. A subject line is supposed to be a line summarising the subject of the post. Just so you'll know for next time.