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
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
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
Acorn Arcade forums: Programming: PHP: difference = and =&
 
  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
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 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
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 11: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 13: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 17: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 19: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 09: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 09: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 09: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 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/ :P
  ^[ Log in to reply ]
 
James Shaw Message #42150, posted by Hertzsprung at 09: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 09: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 09: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 16: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 16: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 10: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 19: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 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
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 08: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 10: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 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
Hertzsprung
Ghost-like

Posts: 1746
Just use Lua. :)
:frown:
  ^[ Log in to reply ]
 
Jeffrey Lee Message #43013, posted by Phlamethrower at 15: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 15: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 15: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 12: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 ]
 

Acorn Arcade forums: Programming: PHP: difference = and =&