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

reference assignment

P: n/a
If I do something like

$r = &$something;

$r = array();

does it refer to $something or does the reference get remove first? if
so(which it seems it is) can I for $r always ot point to $something?

Essentially what I'm trying to do is simplfy the a variable name but I need
to create it if it doesn't exist after the reference.

What I have is a class that contains a variable that points to a session
variable and I want to use that class variable throughout the class as a
reference to the session variable but I have to create the session variable
if it does exist in some cases which seems to be removing the reference and
creating a new variable instead.

Thanks,
Jon
Jun 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jon Slaughter wrote:
If I do something like

$r = &$something;

$r = array();

does it refer to $something or does the reference get remove first? if
so(which it seems it is) can I for $r always ot point to $something?
The reference is removed first. As in all assignments in PHP, the
current assignment replaces the previous one.n
Essentially what I'm trying to do is simplfy the a variable name but I need
to create it if it doesn't exist after the reference.

What I have is a class that contains a variable that points to a session
variable and I want to use that class variable throughout the class as a
reference to the session variable but I have to create the session variable
if it does exist in some cases which seems to be removing the reference and
creating a new variable instead.

Thanks,
Jon


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 2 '07 #2

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:VY******************************@comcast.com. ..
Jon Slaughter wrote:
>If I do something like

$r = &$something;

$r = array();

does it refer to $something or does the reference get remove first? if
so(which it seems it is) can I for $r always ot point to $something?

The reference is removed first. As in all assignments in PHP, the current
assignment replaces the previous one.n
Ok, its not what I thought then. Not like C/C++ references and unfortunately
doesn't help me with what I wanted to do ;/ Guess I have to not use them in
this case ;/

Thanks,
Jon

Jun 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.