note 82150 deleted from language.operators.increment by hholzgra

From: Date: Thu, 02 Aug 2012 15:23:48 +0000
Subject: note 82150 deleted from language.operators.increment by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189858@lists.php.net to get a copy of this message
Note Submitter: pov at fingerprint dot fr ---- In reply to Anonymous : What is strange is that you didn't get an error : ++$var is an expression and can't therefore not be referenced. Now, if you suppose an implicit assignment to an invisible variable, your code becomes : <?php $var = 1; $plus_plus_var = ++$var; change($plus_plus_var); echo "var=$var"; ?> Written as such, change clearly acts on $plus_plus_var, not on $var. So PHP5 got right, and it's not a "strange behaviour", it's only a solved bug. Anyway, it's always a bad idea to pass anything other than a variable as a by-reference parameter...

« previous php.notes (#189858) next »