Hello,

"Matt" <[EMAIL PROTECTED]> wrote:

> I think what's happening here is a type issue. The comparison is returning
a
> boolean, so when $c != '0', the switch is true and the case is resolving
to
> true, and executing.  But when $c == '0', with switch is (false), but the
> case is true.  Change the case to
> ($c > chr(58) and $c < chr(58)):
> pass in '09090' and see what you get.  Perhaps the case isn't the right
> structure for this test.

I think you're in the right track.

Running these would produce different results:

---------- script 1 ----------
$s = '0';
switch ($s){
  case ($s > chr(47) && $s < chr(58)):
    echo 'Yehey!';
    break;
  default:
    echo 'Boo!';
}

---------- script 2 ----------
$s = 0;
switch ($s){
  case ($s > chr(47) && $s < chr(58)):
    echo 'Yehey!';
    break;
  default:
    echo 'Boo!';
}

BTW, there's no problem if you use "if...else" clause...

- E


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to