Date: 12/21/00
- Next message: stas <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Previous message: john <email protected>: "[PHP-DEV] PHP 4.0 Bug #8354: session_unset() causes a segfault"
- In reply to: samuel.blume <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Next in thread: stas <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You should read this page in the manual about Operator Precedence.
http://www.php.net/manual/language.operators.precedence.php
AND has a lower precedence than =, so $val = TRUE AND FALSE is the same as
($val = TRUE) and FALSE.
Also, you want && (logical and) instead of & (bitwise and) in your later
example. (Although, & does have an even tighter binding than &&, so that
"works," too.)
-adam
On 21 Dec 2000 samuel.blume <email protected> wrote:
> ID: 8348
> User Update by: samuel.blume <email protected>
> Status: Open
> Bug Type: Scripting Engine problem
> Description: $val = TRUE AND FALSE; // Will always give TRUE !!
>
> Ups... a little typo above // bool(false) should be // bool(true)
>
>
> $val = TRUE AND FALSE; //Will always give TRUE !!
> var_dump($val); // = bool(true)
>
> using () or & will have the right effect
> $val = (TRUE AND FALSE);
> var_dump($val); // = int(0)
>
> $val = TRUE & FALSE;
> var_dump($val); // = int(0)
>
>
> Previous Comments:
> ---------------------------------------------------------------------------
>
> [2000-12-21 06:57:03] samuel.blume <email protected>
> Folling is unusual:
>
> $val = TRUE AND FALSE; //Will always give TRUE !!
> var_dump($val); // = bool(false)
>
> using () will have the right effect
> $val = (TRUE AND FALSE);
> var_dump($val); // = int(0)
>
>
> ---------------------------------------------------------------------------
>
>
> Full Bug description available at: http://bugs.php.net/?id=8348
>
>
>
-- / adam maccabee trachtenberg | visit college life online \ \ adam <email protected> | http://www.student.com /-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: stas <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Previous message: john <email protected>: "[PHP-DEV] PHP 4.0 Bug #8354: session_unset() causes a segfault"
- In reply to: samuel.blume <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Next in thread: stas <email protected>: "[PHP-DEV] PHP 4.0 Bug #8348 Updated: $val = TRUE AND FALSE; // Will always give TRUE !!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

