note 48468 added to language.references.return

From: Date: Fri, 24 Dec 2004 21:09:31 +0000
Subject: note 48468 added to language.references.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-82281@lists.php.net to get a copy of this message
An example of returning references: <? $var = 1; $num = NULL; function &blah() { $var =& $GLOBALS["var"]; # the same as global $var; $var++; return $var; } $num = &blah(); echo $num; # 2 blah(); echo $num; # 3 ?> Note: if you take the & off from the function, the second echo will be 2, because without & the var $num contains its returning value and not its returning reference. ---- Manual Page -- http://www.php.net/manual/en/language.references.return.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48468 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48468&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48468&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82281) next »