Re: Boolean type forced on string assignment inside if statement

From: Date: Thu, 03 Jan 2013 16:33:22 +0000
Subject: Re: Boolean type forced on string assignment inside if statement
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-320006@lists.php.net to get a copy of this message
> First, did the original poster realize that he was assigning a value to the > variable $a in the 'if' statement? Hello, Yes, I did, and if you read my responses you can see that I came to the realisations you describe. I don't think that anyone suggested there was a bug. > $a is true (ie it is not set to a 'false' value, > whatever PHP uses for false) and $b is "bar" because that is what it is set > to. Since the evaluation is within a bracket, the interior values ($a, $b) > are set BEFORE the if condition is evaluated. Regarding this I'm a bit confused. In the case of an OR operator, $b is not "bar" because it follows the "true" path as you said earlier. Probably just a glitch in the English language. I'll file a bug for that. Marc

« previous php.general (#320006) next »