You are here: Re: [PHP] Seemingly weird regex problem « PHP « IT news, forums, messages
Re: [PHP] Seemingly weird regex problem

Posted by Bret Hughes on 01/20/05 20:14

On Thu, 2005-01-20 at 11: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.
>

yeah, the discussion for switch illustrates the use of functions in
case statements. I have never done it and I wonder if there is a
difference in what preg_replace returns vs what is "true" but if that
was an issue, why doesn't the if catch it. wish I had time to play.

Bret

http://www/php.net/switch

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация