note 96244 added to language.operators.assignment
| From: | joeyadams3 dot 14159 at gmail dot com | Date: | Wed, 17 Feb 2010 07:02:07 +0000 |
| Subject: | note 96244 added to language.operators.assignment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166046@lists.php.net to get a copy of this message | ||
This page should mention the assign-by-reference idiom (as described in http://www.php.net/manual/en/language.references.whatdo.php
), such as this code used to get current user info in Joomla:
<?php
$user =& JFactory::getUser();
?>
Unless I'm misinformed, there really isn't a =& operator; it's actually parsed
as:
<?php
$user = &(JFactory::getUser());
?>
Which means get a reference to the data and assign it to $user.
Assign-by-reference syntax ( =& ) should not be confused with boolean AND assignment ( &= ).
Example:
<?php
$a = 0xABCD;
// boolean AND
$a &= 0xFF; // $a will be 0xCD
// assign-by-reference idiom
$b =& $a;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 208.96.182.115
----
Manual Page -- http://www.php.net/manual/en/language.operators.assignment.php
Edit -- https://master.php.net/note/edit/96244
Del: integrated -- https://master.php.net/note/delete/96244/integrated
Del: useless -- https://master.php.net/note/delete/96244/useless
Del: bad code -- https://master.php.net/note/delete/96244/bad+code
Del: spam -- https://master.php.net/note/delete/96244/spam
Del: non-english -- https://master.php.net/note/delete/96244/non-english
Del: in docs -- https://master.php.net/note/delete/96244/in+docs
Del: other reasons-- https://master.php.net/note/delete/96244
Reject -- https://master.php.net/note/reject/96244
Search -- https://master.php.net/manage/user-notes.php