Re: Is this a missing feature?

From: Date: Sun, 04 Feb 2001 21:32:55 +0000
Subject: Re: Is this a missing feature?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-38145@lists.php.net to get a copy of this message
On Sunday 04 February 2001 20:09, Lux wrote: > > Now, let me tell you that somehow I agreed with you :) cause I love > > Python way > > of dealing with arrays, but we are in PHP, so we have to figure PHP > > way, > Let's make PHP our favourite language! If another has a better > feature, take it. But the feature is useless :) Let me elaborate: You declared your function as function foo (&$hash) That is you take a reference to that parameter ($hash). That's only useful if you want to modify that parameter in such a way that the caller also notices that modification. Now if you pass an anonymous array to the function, you could modify that, but after your function exits that array is automatically destroyed, before the caller can do anything with it. So if you don't have a good reason to use a reference in that place (I very much assume you don't), use normal pass-by-value. In PHP4 that's just as fast as pass-by-reference (read http://www.zend.com/zend/art/ref-count.php) -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka", but "That's funny..." - Isaac Asimov

« previous php.general (#38145) next »