How to use comparison operators in switch statement in PHP

<?php
$number = 27;

switch(true)
{
    case ($number > 100):
        echo 'Bigger than hundred';
    break;
  
    case ($number < 100):
        echo 'Lower than hundred';
    break;
  
    default:
        echo 'Equal to hundred';
    break;
}
?>

Comments

Popular posts from this blog

Timus 1209. 1, 10, 100, 1000... accepted solution in C

Timus Problem 1086. Cryptography Accepted Solution in C

Timus 1083. Factorials!!! Accepted Solution in C