Re: Seemingly weird regex problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-01-20 at 12:59, Richard Lynch wrote:
> Tim Boring wrote:
> > Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
> > trying to accomplish:
> 
> >     switch ($line)
> >     {
> >         case ($total_counter <= 5):
> >         break;
> >        case preg_match("/^\W+/", $line):
> 
> While it would be Really Nifty (tm) if PHP worked this way, as far as I
> know, you can only have a CONSTANT in your case.
> 
> switch($char){
>   case 'X': echo "It was an X"; break;
> }
> 
> You can't just put arbitrary expressions there...
> 
> Feel free to correct me if the Manual sez different.

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

Tim

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux