On Fri, Jan 4, 2013 at 1:56 AM, Sebastian Krebs krebs@gmail.com wrote:
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
Bit operators are not comparing values, they're COMBINING values.
Technically spoken they're comparing bits, whereas boolean operators does
the same, but treaten
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
On Fri, Jan 4, 2013 at 1:56 AM, Sebastian Krebs krebs@gmail.com
wrote:
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
Bit operators are not comparing values, they're COMBINING values.
Technically spoken they're comparing
On Fri, Jan 4, 2013 at 4:25 PM, Sebastian Krebs krebs@gmail.com wrote:
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
On Fri, Jan 4, 2013 at 1:56 AM, Sebastian Krebs krebs@gmail.com
wrote:
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
Bit operators are not
On 1/2/2013 2:02 PM, Marc Guay wrote:
Something else that's happening with this, which makes it a Bad Idea
(tm) is that when the operator is or, as it is in my real life
scenerio, the 2nd variable occasionally doesn't get populated if the
first one returns true.
if ($a = foo || $b = bar){
On Thu, 3 Jan 2013, Jim Giner wrote:
The only time I use a single '=' symbol in an if statement is when I forget
to use two of them! Must be my old school, old languages habits but this
style of programming reminds me of the days when we used to pack empty spaces
in assembler code with
On Thursday 03 January 2013 10:26:39 Jim Giner wrote:
On 1/2/2013 2:02 PM, Marc Guay wrote:
Something else that's happening with this, which makes it a Bad Idea
(tm) is that when the operator is or, as it is in my real life
scenerio, the 2nd variable occasionally doesn't get populated if
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
On Thursday 03 January 2013 11:33:22 Marc Guay wrote:
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
On Thu, Jan 3, 2013 at 11:49 AM, Marc Guay marc.g...@gmail.com wrote:
Hi John,
I just ran this:
if (($a = foo) || ($b = bar)){
echo $a.br /.$b;
}
and it only spat out foo so I'm guessing things have changed. :)
Marc
--
PHP General Mailing List (http://www.php.net/)
To
On Jan 3, 2013, at 11:49 AM, Marc Guay marc.g...@gmail.com wrote:
I just ran this:
if (($a = foo) || ($b = bar)){
echo $a.br /.$b;
}
and it only spat out foo so I'm guessing things have changed. :)
Marc
Marc et al:
I joined late into this conversation, so I may be missing the
Hi Tedd,
A little searching enlightened me to the fact that in other languages,
a single | or operator will cancel the short-circuiting so all of
the evaluations are done before proceeding. However, they don't seem
to exist in PHP so in your example it behaves the same as ||...?
On Jan 3, 2013, at 12:09 PM, David OBrien dgobr...@gmail.com wrote:
From what I understood about || is once it sees a true the whole statement
is regarded as true so nothing else following matters so PHP ignores
everything in the conditional after it evaluates as true...
and once it sees a
On 01/03/2013 09:25 AM, Marc Guay wrote:
Hi Tedd,
A little searching enlightened me to the fact that in other languages,
a single | or operator will cancel the short-circuiting so all of
the evaluations are done before proceeding. However, they don't seem
to exist in PHP so in your example it
/language.operators.bitwise.php
-- Forwarded message --
From: Volmar Machado qi.vol...@gmail.com
Date: 3 January 2013 12:42
Subject: Re: [PHP] Boolean type forced on string assignment inside if statement
To: Marc Guay marc.g...@gmail.com
My results in a simple test:
?php
$a = true;
$b
-numbers).
http://php.net/manual/en/language.operators.bitwise.php
-- Forwarded message --
From: Volmar Machado qi.vol...@gmail.com
Date: 3 January 2013 12:42
Subject: Re: [PHP] Boolean type forced on string assignment inside if
statement
To: Marc Guay marc.g...@gmail.com
My
Volmar Machado qi.vol...@gmail.com wrote:
When the one of the operators were 2, the cases with
returns 2 otherwise returns 0 (Or 1 when any operator is 1). And if
the operators are 1 and 2, return 0 too. Its curious for me.
is the bitwise and operator. You have to look at the binary
Based on what I learned. I create this simple sample that can occurs
in a real world application.
This simulate a system that needs to send a mail when a flag ($mail)
is true, the system need to
check if the category is passed with the flag to know the type of mail to send.
Here is the results.
On 01/03/2013 11:43 AM, Andreas Perstinger wrote:
is the bitwise and operator.
So is a single pipe.
http://php.net/manual/en/language.operators.bitwise.php
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
2013/1/4 tamouse mailing lists tamouse.li...@gmail.com
Bit operators and | are NOT and should NEVER be confused with
Logical operators and ||:
?php
/**
* Bit operators in PHP
*/
$format = Decimal: %2d Binary: %4b\n;
$a = 4;
$b = 6;
echo Variable \$a:\n;
printf($format, $a,
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
--
PHP
On 01/02/2013 07: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?
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 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()?
22 matches
Mail list logo