List Info

Thread: note 78345 added to language.operators.assignment




note 78345 added to language.operators.assignment
user name
2007-10-07 17:22:17
bradlis7 at bradlis7 dot com's description is a bit
confusing. Here it is rephrased.

<?php
$a = 'a';
$b = 'b';

$a .= $b .= "foo";

echo $a,"n",$b;?>
outputs

abfoo
bfoo

Because the assignment operators are right-associative and
evaluate to the result of the assignment
<?php
$a .= $b .= "foo";
?>
is equivalent to
<?php
$a .= ($b .= "foo");
?>
and therefore
<?php
$b .= "foo";
$a .= $b;
?>
----
Server IP: 203.89.181.186
Probable Submitter: 60.234.168.92
----
Manual Page -- http://www.php.net/manual/en/language.operators.as
signment.php
Edit        -- https://master
.php.net/note/edit/78345
Del: integrated  -- h
ttps://master.php.net/note/delete/78345/integrated
Del: useless     -- http
s://master.php.net/note/delete/78345/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78345/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78345/spam
Del: non-english -- 
https://master.php.net/note/delete/78345/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78345/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78345
Reject      -- https://mast
er.php.net/note/reject/78345
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )