Reputation: 1202
I don't quite understands this.. Take a look at the following:
$value = 0;
if($value >= 90) {
// this does not return true
}
switch($value) {
case $value >= 90:
// this however does
break;
}
Am i missing something very obvious ?
Upvotes: 1
Views: 508
Reputation: 54841
$value >= 90
evaluates to false
As $value
is 0, it is considered false
. That's why your case
works.
In a simple way it can be rewritten as:
switch($value) {
case false:
// this works
break;
}
Upvotes: 5