国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Why does my switch automatically output the first case?
MArtian
MArtian 2019-11-16 16:13:12
0
2
1323
<form action="" method="get">
    <label for="score">請(qǐng)輸入成績(jī):</label><input type="number" id="score" name="score" max="100" value="">
    <button>提交</button>
</form>
$init = $_GET['score'];
switch($init){
    case $init >=90 :
    echo '<p>厲害了,我的學(xué)霸!</p>';
    break;
    case $init >=80 :
    echo '<p>再接再厲,努力吧!</p>';
    break;
    case $init >=70 :
    echo '<p>差太多啦!得加油趕上了?。?lt;/p>';
    break;
    case $init >=60 :
    echo '<p>建議你留級(jí)吧?。?lt;/p>';
    break;
    default:
        break;
}

1.png

Obviously no parameters have been passed to the form yet, so how come the first case is output? At this time, the $init variable is empty. How can it be judged successful? ? What's going on? ?

MArtian
MArtian

reply all(1)
盧小強(qiáng)

If you submit without inputting anything, the submitted value will be empty. Empty does not meet any switch conditions, so it will start execution from the first CASE and will not stop until it encounters break

  • reply Will switch run even if the conditions are not met? That's it, thank you
    MArtian author 2019-11-17 12:41:30
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template