php条件(不同的值)

php condition (IN DIFFERENT VALUE)

if $tt > 29 print Good , if $tt < 55 print Very good but when $tt= less than 0 print very bad in php

Your question has too may loopholes and few numbers are overlapping your conditions and few are comming in no condition.

So here is a code which will print

  1. very bad for number less than or equal to 0
  2. bad for number 1 to 29
  3. good for 30 to 55
  4. very good for 55 and above

You can chenge number based on your needs

<?php
if( $tt <= 0 ) {
  echo "Very Bad";
} else if( $tt <= 29) {
  echo "Bad";
} else if( $tt <= 55) {
 echo "Good";
} else {
 echo "Very Good";
}
?>
<?php
if( $tt > 29 ) {
 print "Good";
} else if( $tt > 29 &&  $tt < 55) {
 print "Very Good";
} else if( $tt < 0) {
 print "Very bad";
}
?>

Here you go

 <?php
 if( $tt > 29 ) {
  echo "Greater Than 29 ";
 } else if( $tt > 29 &&  $tt < 55) {
       echo "Greater Than 29 and less than 55 ";
 } else if( $tt < 0) {
  echo "less than zero ";
 }
 ?>