note 18556 rejected from language.references.return by jimw

From: Date: Mon, 28 Jan 2002 01:21:18 +0000
Subject: note 18556 rejected from language.references.return by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25882@lists.php.net to get a copy of this message
<? // Refrence by function: HOW ? class A { var $ca = "A class variable"; function getvar(){return $this->ca;} } class B { var $ca = "B class variable"; function getvar(){return $this->ca;} } class FunctionRefrence { var $classrefr; function &FunctionRefrence() { $this->classrefr[0] = & New A; $this->classrefr[1] = & New B; } function getrefr($refrid){return $this->classrefr[$refrid];} } // ==================================================== $MyObj = New FunctionRefrence; // we can do that: $tmp = $MyObj->getrefr(0); echo $tmp->getvar()."<BR>"; $tmp = $MyObj->getrefr(1); echo $tmp->getvar(); // also can: echo $MyObj->classrefr[0]->getvar(); // ++++++++++++++++++++++++++++++++ // but HOW do that or likewise (one row with argument processing) $MyObj->getrefr(0)->getvar(); ?>

« previous php.notes (#25882) next »