473,387 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

passing references

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
2 1905
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
12
by: Mike | last post by:
Consider the following code: """ struct person { char *name; int age; }; typedef struct person* StructType;
8
by: Ivan Liu | last post by:
Hi, I'd like to ask if passing an object as an pointer into a function evokes the copy constructor. Ivan
7
by: Johannes Bauer | last post by:
Hello Group, please consider the following code #include <vector> #include <iostream> #define USE_CONST #define USE_STRING
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.