Re: Weird behaviour with references to objects...

From: Date: Fri, 08 Nov 2002 16:04:29 +0000
Subject: Re: Weird behaviour with references to objects...
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-123402@lists.php.net to get a copy of this message
"Ernest E Vogelsinger" <ernest@vogelsinger.at> wrote in message news:5.1.1.6.2.20021108165218.03238948@mail.vogelsinger.at... > One more: > > True for now, but this is "officially deprecated". Functions or methods > accepting a reference are required to be "prototyped" that way - this helps > you not to "forget" to pass by reference. You really should modify your > functions using reference parameters when declaring them, if you're using > references... > Yes I know it is poor programming habits to do like I did... But I have a reason for it. I have quite a lot methods that accept objects *optional*. So f.e.: --- class Product { var $language; function Product($language = FALSE) { $this->language = $language; } } --- Now to make this possible it becomes impossible to do what you suggest: function Product(&$language = FALSE) is not allowed. And in my application this optional arguments functionality is very important. So I have preferred this over the decent habit. > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ >

« previous php.general (#123402) next »