log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Archive Edition 27:2 reviewed (News:)
- WROCC May 2024 meeting - Gerph talks games (News:)
- Drag'n'Drop 13i3 edition reviewed (News:1)
- Wakefield Show 2024 in Pictures (News:5)
- April 2024 News Summary (News:2)
- RISC OS 5.30 arrives (News:2)
- Upgrading your RISC OS system to 5.30 (News:2)
- WROCC May 2024 meeting on wednesday - Gerph talks games (News:)
- uniprint upgraded to 4.50 (News:)
- PhotoDesk 3.23 released (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Programming: PHP: difference = and =&
 
  PHP: difference = and =&
  Hertzsprung (10:39 12/5/2003)
  alpha (10:53 12/5/2003)
    Phlamethrower (11:49 12/5/2003)
      Hertzsprung (12:39 12/5/2003)
        rich (14:23 12/5/2003)
          Hertzsprung (18:46 13/5/2003)
            moss (20:44 13/5/2003)
              andrew (10:59 14/5/2003)
              andrew (10:59 14/5/2003)
                Hertzsprung (10:25 16/5/2003)
                  jmb (10:36 16/5/2003)
                  moss (10:36 16/5/2003)
                    Hertzsprung (10:41 16/5/2003)
                      moss (10:46 16/5/2003)
                        Hertzsprung (17:14 18/5/2003)
                          Matthew (17:59 18/5/2003)
                            andrew (11:02 19/5/2003)
                            Hertzsprung (20:16 20/5/2003)
                              alpha (00:23 21/5/2003)
                                Hertzsprung (19:03 27/5/2003)
                                  rich (09:36 28/5/2003)
                                    andrew (11:24 28/5/2003)
                  diodesign (10:41 16/5/2003)
  takkaria (16:29 29/5/2003)
    Hertzsprung (16:35 29/5/2003)
      Phlamethrower (16:40 29/5/2003)
        Hertzsprung (16:54 29/5/2003)
          Phlamethrower (16:57 29/5/2003)
            Hertzsprung (13:56 30/5/2003)
 
James Shaw Message #41836, posted by Hertzsprung at 10:39, 12/5/2003
Hertzsprung
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 10: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 11:49, 12/5/2003, in reply to message #41839
PhlamethrowerHot 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 12:39, 12/5/2003, in reply to message #41851
Hertzsprung
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 =& ? :P
  ^[ Log in to reply ]
 
Richard Goodwin Message #41864, posted by rich at 14:23, 12/5/2003, in reply to message #41859
Rich
Dictator for life
Posts: 6828
And how come a mysterious bug disappeared when I changed = to =& ? :P
You're a p***-poor programmer that was referencing the wrong variable in the first place? :P
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
James Shaw Message #41991, posted by Hertzsprung at 18:46, 13/5/2003, in reply to message #41864
Hertzsprung
Ghost-like

Posts: 1746
And how come a mysterious bug disappeared when I changed = to =& ? :P
You're a p***-poor programmer that was referencing the wrong variable in the first place? :P
:cry:
I'm referencing the right object, I just don't understand these pesky references properly :cry:
  ^[ Log in to reply ]
 
John Hoare Message #41993, posted by moss at 20:44, 13/5/2003, in reply to message #41991

Posts: 9348
:cry:
I'm referencing the right object, I just don't understand these pesky references properly :cry:
:P
  ^[ Log in to reply ]
 
Andrew Message #42015, posted by andrew at 10:59, 14/5/2003, in reply to message #41993
HandbagHandbag Boi
Posts: 3439
:cry:
I'm referencing the right object, I just don't understand these pesky references properly :cry:
:P
:laugh:
  ^[ Log in to reply ]
 
Andrew Message #42016, posted by andrew at 10:59, 14/5/2003, in reply to message #41993
HandbagHandbag Boi
Posts: 3439
:cry:
I'm referencing the right object, I just don't understand these pesky references properly :cry:
:P
:laugh:
  ^[ Log in to reply ]
 
James Shaw Message #42146, posted by Hertzsprung at 10:25, 16/5/2003, in reply to message #42016
Hertzsprung
Ghost-like

Posts: 1746
GAH! Someone help me!
  ^[ Log in to reply ]
 
JMB Message #42148, posted by jmb at 10: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 10:36, 16/5/2003, in reply to message #42146

Posts: 9348
GAH! Someone help me!
http://www.php.net/ :P
  ^[ Log in to reply ]
 
James Shaw Message #42150, posted by Hertzsprung at 10:41, 16/5/2003, in reply to message #42149
Hertzsprung
Ghost-like

Posts: 1746
GAH! Someone help me!
http://www.php.net/ :P
:hertzsprung: tortures :moss: 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 10:41, 16/5/2003, in reply to message #42146
diodesign
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 10:46, 16/5/2003, in reply to message #42150

Posts: 9348
:hertzsprung: tortures :moss: in all manner of ways.

DO YOU WANT THIS NEWS SYSTEM OR NOT?
:cry:
  ^[ Log in to reply ]
 
James Shaw Message #42279, posted by Hertzsprung at 17:14, 18/5/2003, in reply to message #42152
Hertzsprung
Ghost-like

Posts: 1746
:hertzsprung: tortures :moss: in all manner of ways.

DO YOU WANT THIS NEWS SYSTEM OR NOT?
:cry:
:|. Still no answers :(
  ^[ Log in to reply ]
 
Matthew Somerville Message #42291, posted by Matthew at 17:59, 18/5/2003, in reply to message #42279
Matthew

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 11:02, 19/5/2003, in reply to message #42291
HandbagHandbag 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 :razz:
  ^[ Log in to reply ]
 
James Shaw Message #42567, posted by Hertzsprung at 20:16, 20/5/2003, in reply to message #42291
Hertzsprung
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 00:23, 21/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 19:03, 27/5/2003, in reply to message #42601
Hertzsprung
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 09:36, 28/5/2003, in reply to message #42864
Rich
Dictator for life
Posts: 6828
Cop out! Doesn't want his dodgy code laughed at! ;)
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Andrew Message #42901, posted by andrew at 11:24, 28/5/2003, in reply to message #42893
HandbagHandbag Boi
Posts: 3439
Maybe because 1 or 2 people will :doody: on it as well ;)
  ^[ Log in to reply ]
 
Andrew Sidwell Message #42998, posted by takkaria at 16: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 16:35, 29/5/2003, in reply to message #42998
Hertzsprung
Ghost-like

Posts: 1746
Just use Lua. :)
:frown:
  ^[ Log in to reply ]
 
Jeffrey Lee Message #43013, posted by Phlamethrower at 16:40, 29/5/2003, in reply to message #43008
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Use befunge! :monkey:
  ^[ Log in to reply ]
 
James Shaw Message #43018, posted by Hertzsprung at 16:54, 29/5/2003, in reply to message #43013
Hertzsprung
Ghost-like

Posts: 1746
Use befunge! :monkey:
CGI befunge! :E
  ^[ Log in to reply ]
 
Jeffrey Lee Message #43019, posted by Phlamethrower at 16:57, 29/5/2003, in reply to message #43018
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Use befunge! :monkey:
CGI befunge! :E
Yes, that's the idea. It does exist, you know :o

No links though, because the official site is still in pieces :(
  ^[ Log in to reply ]
 
James Shaw Message #43047, posted by Hertzsprung at 13:56, 30/5/2003, in reply to message #43019
Hertzsprung
Ghost-like

Posts: 1746
Use befunge! :monkey:
CGI befunge! :E
Yes, that's the idea. It does exist, you know :o

No links though, because the official site is still in pieces :(
Gawd :o
  ^[ Log in to reply ]
 

The Icon Bar: Programming: PHP: difference = and =&