|
PHP: difference = and =& |
|
Hertzsprung (09:39 12/5/2003) alpha (09:53 12/5/2003) Phlamethrower (10:49 12/5/2003) Hertzsprung (11:39 12/5/2003) rich (13:23 12/5/2003) Hertzsprung (17:46 13/5/2003) moss (19:44 13/5/2003) andrew (09:59 14/5/2003) andrew (09:59 14/5/2003) Hertzsprung (09:25 16/5/2003) jmb (09:36 16/5/2003) moss (09:36 16/5/2003) Hertzsprung (09:41 16/5/2003) moss (09:46 16/5/2003) Hertzsprung (16:14 18/5/2003) Matthew (16:59 18/5/2003) andrew (10:02 19/5/2003) Hertzsprung (19:16 20/5/2003) alpha (23:23 20/5/2003) Hertzsprung (18:03 27/5/2003) rich (08:36 28/5/2003) andrew (10:24 28/5/2003) diodesign (09:41 16/5/2003) takkaria (15:29 29/5/2003) Hertzsprung (15:35 29/5/2003) Phlamethrower (15:40 29/5/2003) Hertzsprung (15:54 29/5/2003) Phlamethrower (15:57 29/5/2003) Hertzsprung (12:56 30/5/2003)
|
|
James Shaw |
Message #41836, posted by Hertzsprung at 09:39, 12/5/2003 |
Ghost-like
Posts: 1746
|
What's the difference? Should I always be using =&, does = use more memory? |
|
[ Log in to reply ] |
|
Tim Fountain |
Message #41839, posted by alpha at 09:53, 12/5/2003, in reply to message #41836 |
Forum bod
Posts: 570
|
Should I always be using =& No.
does = use more memory? Well, sort of. =& means 'assign a reference', whereas = is 'assign the value' (so you're therefore copying it). They have different uses so use the one that you need . |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #41851, posted by Phlamethrower at 10:49, 12/5/2003, in reply to message #41839 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Indeed.
$a = 1; $b =& $a; $a = 2; echo $b;
Will output 2, which might not always be what you're after. |
|
[ Log in to reply ] |
|
James Shaw |
Message #41859, posted by Hertzsprung at 11:39, 12/5/2003, in reply to message #41851 |
Ghost-like
Posts: 1746
|
Erm, what I meant to ask was about $a=new Blah() and $a=&Blah() -- what exactly happens which each of those? And how come a mysterious bug disappeared when I changed = to =& ? |
|
[ Log in to reply ] |
|
Richard Goodwin |
Message #41864, posted by rich at 13:23, 12/5/2003, in reply to message #41859 |
Dictator for life
Posts: 6828
|
And how come a mysterious bug disappeared when I changed = to =& ? You're a p***-poor programmer that was referencing the wrong variable in the first place? ________ Cheers, Rich.
|
|
[ Log in to reply ] |
|
James Shaw |
Message #41991, posted by Hertzsprung at 17:46, 13/5/2003, in reply to message #41864 |
Ghost-like
Posts: 1746
|
And how come a mysterious bug disappeared when I changed = to =& ? You're a p***-poor programmer that was referencing the wrong variable in the first place?
I'm referencing the right object, I just don't understand these pesky references properly |
|
[ Log in to reply ] |
|
John Hoare |
Message #41993, posted by moss at 19:44, 13/5/2003, in reply to message #41991 |
Posts: 9348
|
I'm referencing the right object, I just don't understand these pesky references properly
|
|
[ Log in to reply ] |
|
Andrew |
Message #42015, posted by andrew at 09:59, 14/5/2003, in reply to message #41993 |
Handbag Boi
Posts: 3439
|
I'm referencing the right object, I just don't understand these pesky references properly
|
|
[ Log in to reply ] |
|
Andrew |
Message #42016, posted by andrew at 09:59, 14/5/2003, in reply to message #41993 |
Handbag Boi
Posts: 3439
|
I'm referencing the right object, I just don't understand these pesky references properly
|
|
[ Log in to reply ] |
|
James Shaw |
Message #42146, posted by Hertzsprung at 09:25, 16/5/2003, in reply to message #42016 |
Ghost-like
Posts: 1746
|
GAH! Someone help me! |
|
[ Log in to reply ] |
|
JMB |
Message #42148, posted by jmb at 09:36, 16/5/2003, in reply to message #42146 |
Member
Posts: 467
|
n0. |
|
[ Log in to reply ] |
|
John Hoare |
Message #42149, posted by moss at 09:36, 16/5/2003, in reply to message #42146 |
Posts: 9348
|
GAH! Someone help me! http://www.php.net/ |
|
[ Log in to reply ] |
|
James Shaw |
Message #42150, posted by Hertzsprung at 09:41, 16/5/2003, in reply to message #42149 |
Ghost-like
Posts: 1746
|
GAH! Someone help me! http://www.php.net/ tortures in all manner of ways.
DO YOU WANT THIS NEWS SYSTEM OR NOT? |
|
[ Log in to reply ] |
|
Chris Williams |
Message #42151, posted by diodesign at 09:41, 16/5/2003, in reply to message #42146 |
The Opposition
Posts: 269
|
GAH! Someone help me! Ok, fastcgi. Break out that compiler.
Chris. |
|
[ Log in to reply ] |
|
John Hoare |
Message #42152, posted by moss at 09:46, 16/5/2003, in reply to message #42150 |
Posts: 9348
|
tortures in all manner of ways.
DO YOU WANT THIS NEWS SYSTEM OR NOT? |
|
[ Log in to reply ] |
|
James Shaw |
Message #42279, posted by Hertzsprung at 16:14, 18/5/2003, in reply to message #42152 |
Ghost-like
Posts: 1746
|
tortures in all manner of ways.
DO YOU WANT THIS NEWS SYSTEM OR NOT? . Still no answers |
|
[ Log in to reply ] |
|
Matthew Somerville |
Message #42291, posted by Matthew at 16:59, 18/5/2003, in reply to message #42279 |
Posts: 520
|
. Still no answers Well, to be fair, you haven't asked a question that's particularly easy to answer without access to the source code, and what exactly you're doing. http://www.php.net/manual/en/language.references.return.php seems to maybe be relevant, along with the whole of the references section - I don't think you want to be using references unless you know exactly what you're doing with them. |
|
[ Log in to reply ] |
|
Andrew |
Message #42366, posted by andrew at 10:02, 19/5/2003, in reply to message #42291 |
Handbag Boi
Posts: 3439
|
. Still no answers Well, to be fair, you haven't asked a question that's particularly easy to answer without access to the source code, and what exactly you're doing. http://www.php.net/manual/en/language.references.return.php seems to maybe be relevant, along with the whole of the references section - I don't think you want to be using references unless you know exactly what you're doing with them.
Just give him the damn answer man |
|
[ Log in to reply ] |
|
James Shaw |
Message #42567, posted by Hertzsprung at 19:16, 20/5/2003, in reply to message #42291 |
Ghost-like
Posts: 1746
|
. Still no answers http://www.php.net/manual/en/language.references.return.php seems to maybe be relevant, along with the whole of the references section - I don't think you want to be using references unless you know exactly what you're doing with them. Well, the problems I'm experiencing are to do with variables set after calling the constructor. Under certain circumstances, when the object gets copied (yeah, I know, that's too vague), the variables initialised in the constructor are preserved, but those set after object construction are undefined.
Perhaps I'll try a PHP forum or sommit. |
|
[ Log in to reply ] |
|
Tim Fountain |
Message #42601, posted by alpha at 23:23, 20/5/2003, in reply to message #42567 |
Forum bod
Posts: 570
|
You'll have to post the code... |
|
[ Log in to reply ] |
|
James Shaw |
Message #42864, posted by Hertzsprung at 18:03, 27/5/2003, in reply to message #42601 |
Ghost-like
Posts: 1746
|
You'll have to post the code... Hmmm, don't worry. There's too much code (with includes and stuff), forget it |
|
[ Log in to reply ] |
|
Richard Goodwin |
Message #42893, posted by rich at 08:36, 28/5/2003, in reply to message #42864 |
Dictator for life
Posts: 6828
|
Cop out! Doesn't want his dodgy code laughed at! ________ Cheers, Rich.
|
|
[ Log in to reply ] |
|
Andrew |
Message #42901, posted by andrew at 10:24, 28/5/2003, in reply to message #42893 |
Handbag Boi
Posts: 3439
|
Maybe because 1 or 2 people will on it as well |
|
[ Log in to reply ] |
|
Andrew Sidwell |
Message #42998, posted by takkaria at 15:29, 29/5/2003, in reply to message #41836 |
Member
Posts: 324
|
Just use Lua. |
|
[ Log in to reply ] |
|
James Shaw |
Message #43008, posted by Hertzsprung at 15:35, 29/5/2003, in reply to message #42998 |
Ghost-like
Posts: 1746
|
Just use Lua. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #43013, posted by Phlamethrower at 15:40, 29/5/2003, in reply to message #43008 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Use befunge! |
|
[ Log in to reply ] |
|
James Shaw |
Message #43018, posted by Hertzsprung at 15:54, 29/5/2003, in reply to message #43013 |
Ghost-like
Posts: 1746
|
Use befunge! CGI befunge! |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #43019, posted by Phlamethrower at 15:57, 29/5/2003, in reply to message #43018 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Use befunge! CGI befunge! Yes, that's the idea. It does exist, you know
No links though, because the official site is still in pieces |
|
[ Log in to reply ] |
|
James Shaw |
Message #43047, posted by Hertzsprung at 12:56, 30/5/2003, in reply to message #43019 |
Ghost-like
Posts: 1746
|
Use befunge! CGI befunge! Yes, that's the idea. It does exist, you know
No links though, because the official site is still in pieces Gawd |
|
[ Log in to reply ] |
|
|