> > 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!'; > }
I think the problem is just the incorrect use of a switch. If you change your code to switch(1) then it works as it should. You should be using if..elseif for your style of "cases". ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php