You are here: Re: alternative php syntax « All PHP « IT news, forums, messages
Re: alternative php syntax

Posted by Johnny on 10/11/35 11:57

"kenoli" <kenoli@igc.org> wrote in message
news:1157394155.661818.105050@p79g2000cwp.googlegroups.com...
>
> I tried using || in the following examples where you used && and got
> the following results:
>
> TRUE || FALSE && $q[] = "number = '{$v}'"; // doesn't set the array
>
> FALSE || TRUE && $q[] = "number = '{$v}'"; // sets the array
>
> What is the syntax here? I would think they should both set the array

No secret. All well documented.
There's simple rules for this, in PHP assignments are parsed in a right to
left order, and there's a thing called operator precedence.
in this case && has more precedence than ||

see here: http://nl3.php.net/manual/en/language.expressions.php
and here:
http://nl3.php.net/manual/en/language.operators.php#language.operators.prece
dence

 

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

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