Home  >  Q&A  >  body text

I tried to use the range() function which seems to work to complete the job, but it fails to execute branches above 60 minutes. I want to know why this method goes wrong.

<form method="post">

<input type="text" name="cj">

<input type="submit" value= "Submit">

</form>

<?php

$cj=$_POST['cj'];

if (is_numeric($cj)&&$cj>0){

if($cj=range(0,60)){

echo 'Failed';

}

elseif($cj=range(61,70)){

echo 'Are you cheering';

}

elseif($ cj=range(71,80)){

echo 'Not bad';

}

elseif($cj=range(81,90)){

echo 'Promotion exam machine';

}

elseif($cj=100){

echo 'Exam machine 2.0';

}

elseif($cj>100){

echo 'Einstein';

}

}else{

echo 'Please enter performance appraisal';

}



##?>


HUNTHUNT2664 days ago1507

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-07-27 13:01:38

    range() generates an array. The content you POST is compared with range() (characters and arrays cannot be compared). In addition, the equality inside is judged to be (==) with two equal signs. Your judgment conditions are all It is an = sign, and an equal sign is a negative value and is not judged.

    reply
    2
  • PHP中文网

    PHP中文网2017-07-27 12:59:09

    Definition and Usage

    range() function creates an array containing elements in a specified range.

    This function returns an array containing elements from low to high.

    Note: If the low parameter is greater than the high parameter, the array created will be from high to low.

    Description

    This function creates an array containing integers or characters from low to high (including low and high). If high is smaller than low, return the array in reverse order.


    reply
    1
  • Cancelreply