PHP如何在2个数字之间设置变量[重复]

This question already has an answer here:

Having trouble, can anyone tell me how I properly set my variable between 2 numbers? I gave it a shot, but this is not right.

<!DOCTYPE html>
<html lang="en">
<head>
    <title> if/else </title>
</head>

    <body>

    <?php
        $randinterger = rand(10,100));

if ($randinterger <= 25) {
    echo ($randinterger);
    echo ("This is less that 25");
} elseif (26 < $randinterger <= 50) {
    echo ($randinterger);
    echo ("This is between 25 and 50");
} elseif (50 < $randinterger <= 75) {
    echo ($randinterger);
    echo ("This is between 50 and 75");
} else (75 < $randinterger <= 100) {
    echo ($randinterger);
    echo ("This is between 75 and 100");
}

    ?>

</body>
</html>
</div>

You cannot compare numbers like that. See corrected code below.

<?php
        $randinterger = rand(10,100));

if ($randinterger <= 25) {
    echo ($randinterger);
    echo ("This is less that 25");
} elseif (26 < $randinterger && $randinterger <= 50) {
    echo ($randinterger);
    echo ("This is between 25 and 50");
} elseif (50 < $randinterger && $randinterger <= 75) {
    echo ($randinterger);
    echo ("This is between 50 and 75");
} else (75 < $randinterger && $randinterger <= 100) {
    echo ($randinterger);
    echo ("This is between 75 and 100");
}

    ?>

you have to split the conditions. What you want to know if is randinteger is lower than x AND greater than Y.