You are here: Re: Whats the diffecence between '&' and '&&' operators? « PHP Language « IT news, forums, messages
Re: Whats the diffecence between '&' and '&&' operators?

Posted by Oli Filth on 05/25/05 20:45

Kimmo Laine wrote:
> $var0 = "";
> $var1 = "bunny";
> $default = "default";
<...SNIP...>
> $target = $var0 OR $var1 OR $default;
> echo $target; //outputs bunny

No it doesn't. The result is an empty string.

> Why "bunny"? Seems that using or the operand is assigned into $target, and
> if it's true, it halts. It is evaluated like this:
>
> (($target = $var0) || $target = $var1) || $target = $default;

No it's not. The line is evaluated as:

($target = $var0) || $var1 || $default;



--
Oli

 

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

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