On Thu, 2005-01-20 at 14:40, Bret Hughes wrote: > On Thu, 2005-01-20 at 12:43, Jason Wong wrote: > > On Friday 21 January 2005 02:16, Tim Boring wrote: > > > > > It's perfectly legit to use expressions. Now perhaps there is something > > > wrong with the regex I'm trying to use, but using a regex in and of > > > itself is legal. > > > http://www.php.net/manual/en/control-structures.switch.php > > > > Yes, but comparing those expressions to: > > > > switch ($line) > > > > where $line is a string, doesn't make sense. See my other post. > > > > Chaching ( sound of light bulb turning on) I see that in the example in > the manual it needs to be compared to true ( a boolean value) > > > switch (true) > > rather than switch ($line) > > What is not apparent to me is why the first case matches if the preg > fails. Wouldn't line evaluate to true in a boolean context? Yeah, the light bulb just turned on for me, too. I'll play around with this and change it to boolean, but it still bothers me. My thinking was that $line was the expression that I wanted the switch construct to evaluate based on each case statement. Thus, if the regex turned out to be true, then it matched that case and would perform whatever code was in that branch. Weirdest of all, however, is that I've gone into the source input file and changed the first "word" in each line from text to a numeric value. And the switch statement works just fine. Thanks for the help! Tim > > Bret -- Tim Boring IT Department, Automotive Distributors Toll Free: 800-421-5556 x3007 Direct: 614-532-4240 E-mail: tboring@xxxxxxxx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php