unset()
| From: | Patrick Dunford | Date: | Wed, 04 Apr 2001 11:14:35 +0000 |
| Subject: | unset() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47011@lists.php.net to get a copy of this message | ||
I wrote a function inside a file which I included with a require() call.
The function takes four arguments by reference (because I need to pass back
four values). The first thing it does is to call unset() four times to unset
these arguments, so that it can enter new data into them. This will clear
the variable values in the calling script of course, but is not a problem
because the function needs to clear them so it can put data in them.
However it was a surprise to find that the variables contained data when
checked on the last line of the function, but when checked in the calling
code after the function call had been made, they were empty.
Removing the calls to unset() in the function resolved the problem and I
have put the unset() calls into the calling code immediately before calling
the function. This works but still leaves me with the question.
--
=======================================================================
Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/
Rejoice in the Lord always. I will say it again: Rejoice!
-- Philippians 4:4
http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010404
=======================================================================
Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/