RE: [PHP] A quick question
| From: | Lars Torben Wilson | Date: | Wed, 11 Oct 2000 22:27:06 +0000 |
| Subject: | RE: [PHP] A quick question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19720@lists.php.net to get a copy of this message | ||
richard writes:
> hi Joao,
>
> according to page 110 of "Proffessional PHP programming" (wrox press) the
> operator " ==" means equal to...
> while the operators "=" and "!=" are right associative assignments...
Joao is correct; the book is not. It's an excellent book, but as with
any, there are mistakes: it lists both != and ~= as being assignment
operators, when != is actually a comparison operator and has no effect
when used in an assignment context, and ~= doesn't even exist in PHP
at all.
I think they were typos for ^= and |=.
> therefore using the logic if ($val =="abc") { means if the value of $val is
> equal to "abc" then ...
> while if ($val = "abc") means assign the value of abc to $val and then
> execute the insides of the curly braces. This will ALWAYS be true in your
> example.....
>
> then again, its only a book ;-) - and we are all human !
>
> richard (firm believer in PERL's TMTOWTDI )
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+