On 01/02/2013 10:21 AM, Marc Guay wrote:
Won't this type of condition/test always return true?
I simplified the example. In my real life case the "foo" and "bar"
are variables which can be empty strings, and if they both are not, I
would like to display them.
Marc
Then why not use empty()?
On 01/02/2013 07:53 AM, Marc Guay wrote:
Hi folks,
if ($a = "foo"&& $b = "bar"){
echo $a."".$b;
}
Returns:
1
bar
I expect:
foo
bar
Is this documented?
Marc
Why would you do this.
I cannot envision a time or condition that would require such a "test".
Can you please explain why you
On 02 Jan 2013 at 16:05, Stephen wrote:
> On 13-01-02 10:53 AM, Marc Guay wrote:
>> Hi folks,
>>
>> if ($a = "foo" && $b = "bar"){
>> echo $a."".$b;
>> }
>>
>> Returns:
>> 1
>> bar
>>
>> I expect:
>> foo
>> bar
>>
>> Is this documented?
>>
>
> && takes precedence over =
>
> http://php.net/m
On 13-01-02 10:53 AM, Marc Guay wrote:
Hi folks,
if ($a = "foo" && $b = "bar"){
echo $a."".$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
--
P
4 matches
Mail list logo