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 21:40

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?

Bret

 

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

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