Re: references a functions

From: Date: Thu, 04 Apr 2002 19:19:04 +0000
Subject: Re: references a functions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-91583@lists.php.net to get a copy of this message
I thought that apart from returning an id the result set was created within the scope of the function so when the function finishes the resulted was deleted; But since is just an id an the result is stored somewhere else I wouldn't need any reference. btw where can I read about references besides php manual? Rasmus Lerdorf wrote:
Note that you rarely change a result set, so there is very little point in returning a reference to it given PHP's shallow copy implementation. And in your case you are just returning a resource id which you definitely aren't going to change. But if for some reason you feel it is important (please explain why) then this is the syntax: function & bdConsultar($strCon) { $idRes = @mysql_query($strCon); return $idRes; } $myID = & bdConsultar("Select * from users"); But again, I don't think you are quite understanding references. -Rasmus


« previous php.general (#91583) next »