By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,723 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,723 IT Pros & Developers. It's quick & easy.

passing references

P: n/a
hi all,
i have some doubts in passing variables by references in php.
i usually use
class blah
{
function Params( &$params)
{
$this->params =& $params;
}
}
where $params is an array.
is the second & unnecessary?
is there any difference if $params is object instead of array?

thnx

tole
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Actually it is not a bad idea to do it so...

A few months ago I asked the same question and it was:

Is this good coding practice:

$var = & nl2br($var);

The conclusion of the debate was:

the worst thing it can happen is nothing...

the best thing it can happen is a bit of time & memory saving.....

hope this helps....

point
"Tole" <to*******************@yahoo.com> wrote in message
news:bj************@ID-132821.news.uni-berlin.de...
hi all,
i have some doubts in passing variables by references in php.
i usually use
class blah
{
function Params( &$params)
{
$this->params =& $params;
}
}
where $params is an array.
is the second & unnecessary?
is there any difference if $params is object instead of array?

thnx

tole

Jul 16 '05 #2

P: n/a
I thought support for references was being depreciated.

Why.

point wrote:
Actually it is not a bad idea to do it so...

A few months ago I asked the same question and it was:

Is this good coding practice:

$var = & nl2br($var);

The conclusion of the debate was:

the worst thing it can happen is nothing...

the best thing it can happen is a bit of time & memory saving.....

hope this helps....

point
"Tole" <to*******************@yahoo.com> wrote in message
news:bj************@ID-132821.news.uni-berlin.de...
hi all,
i have some doubts in passing variables by references in php.
i usually use
class blah
{
function Params( &$params)
{
$this->params =& $params;
}
}
where $params is an array.
is the second & unnecessary?
is there any difference if $params is object instead of array?

thnx

tole



Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.