note 58742 added to keyword.paamayim-nekudotayim

From: Date: Mon, 14 Nov 2005 18:20:40 +0000
Subject: note 58742 added to keyword.paamayim-nekudotayim
Groups: php.notes 
Request: Send a blank email to php-notes+get-98552@lists.php.net to get a copy of this message
my last note is actually not 100% correct... as it is, trying to return a reference to an element of the class variables array won't work, even though the classVars function is declared as (possibly) returning a reference... the correct way to return a reference to one of your class variables would be <?php class theClass { ... function &classVars($name = NULL, ...) { static $myClassVars; ... $myRef =& $myClassVars[$name]; return($myRef); } } ?> which works as expected when you're looking for a reference. This should only be necessary when you're trying to return a reference to a piece of the array as opposed to the whole array itself. Simply doing this <?php return($myClassVars); ?> works as expected, ie: you can get a reference to the whole array without needing to explicitly create a reference to it before returning. ---- Manual Page -- http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58742 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58742&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58742&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98552) next »