Re: Boolean type forced on string assignment inside if statement

From: Date: Wed, 02 Jan 2013 16:05:10 +0000
Subject: Re: Boolean type forced on string assignment inside if statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-319995@lists.php.net to get a copy of this message
On 13-01-02 10:53 AM, Marc Guay wrote:
Hi folks, if ($a = "foo" && $b = "bar"){
     echo $a."<br />".$b;
} Returns: 1 bar I expect: foo bar Is this documented?
&& takes precedence over = http://php.net/manual/en/language.operators.precedence.php You may want to use brackets -- Stephen

« previous php.general (#319995) next »