note 101750 added to language.references.whatdo

From: Date: Sun, 09 Jan 2011 01:31:15 +0000
Subject: note 101750 added to language.references.whatdo
Groups: php.notes 
Request: Send a blank email to php-notes+get-175552@lists.php.net to get a copy of this message
In this example class name is different from its first function and however there is no construction function. In the end as you guess "a" and "c" are equal. So if there is no construction function at same time class and its first function names are the same, "a" and "c" doesn't equal forever. In my opinion php doesn't seek any function for the construction as long as their names differ from each others. class reftest_new { public $a = 1; public $c = 1; public function reftest() { $b =& $this->a; $b++; } public function reftest2() { $d =& $this->c; $d++; } } $reference = new reftest_new(); $reference->reftest(); $reference->reftest2(); echo $reference->a; //Echoes 2. echo $reference->c; //Echoes 2. ---- Server IP: 69.147.83.197 Probable Submitter: 78.168.229.119 ---- Manual Page -- http://www.php.net/manual/en/language.references.whatdo.php Edit -- https://master.php.net/note/edit/101750 Del: integrated -- https://master.php.net/note/delete/101750/integrated Del: useless -- https://master.php.net/note/delete/101750/useless Del: bad code -- https://master.php.net/note/delete/101750/bad+code Del: spam -- https://master.php.net/note/delete/101750/spam Del: non-english -- https://master.php.net/note/delete/101750/non-english Del: in docs -- https://master.php.net/note/delete/101750/in+docs Del: other reasons-- https://master.php.net/note/delete/101750 Reject -- https://master.php.net/note/reject/101750 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175552) next »