note 96244 rejected from language.operators.assignment by danbrown

From: Date: Wed, 17 Feb 2010 14:52:47 +0000
Subject: note 96244 rejected from language.operators.assignment by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166067@lists.php.net to get a copy of this message
Note Submitter: joeyadams3 dot 14159 at gmail dot com ---- 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; ?>

« previous php.notes (#166067) next »