Re: Why doesnt pass-by-value work?

From: Date: Mon, 05 Mar 2001 00:40:53 +0000
Subject: Re: Why doesnt pass-by-value work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42544@lists.php.net to get a copy of this message
Ahh - dont worry about this post ... :) AndrewH ----- Original Message ----- From: "Andrew Halliday" <andrew@recalldesign.com> To: <php-general@lists.php.net> Sent: Monday, March 05, 2001 10:51 AM Subject: [PHP] Why doesnt pass-by-value work? > When I call this function: > > function getColumnName($col) > { > if ($col > 0 && $col < pg_numfields($this->lastResultSet)) > return pg_fieldname($this->lastResultSet,$col); > else > return null; > } > > > It returns null all the time ! > The condition is NOT the problem ... Ive tested that with: > > function getColumnName($col) > { > return pg_fieldname($this->lastResultSet,$col); > if ($col > 0 && $col < pg_numfields($this->lastResultSet)) > return pg_fieldname($this->lastResultSet,$col); > else > return null; > } > > And it still returns null. > > If I do this: > > function getColumnName($col) > { > echo pg_fieldname($this->lastResultSet,$col); > return pg_fieldname($this->lastResultSet,$col); > if ($col > 0 && $col < pg_numfields($this->lastResultSet)) > return pg_fieldname($this->lastResultSet,$col); > else > return null; > } > > I do get the correct result printed to the browser ... > So what the HELL is going on? Dont tell me that pass by reference doesnt > work with pg_* functions? > Just to test this, I did this: > > function getColumnName($col) > { > $test = pg_fieldname($this->lastResultSet,$col); > return $test; > if ($col > 0 && $col < pg_numfields($this->lastResultSet)) > return pg_fieldname($this->lastResultSet,$col); > else > return null; > } > > > This made no difference ... WHAT AM I DOING WRONG?! > > AndrewH > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#42544) next »