Reply to Re: if $a =& $b is assignment by reference, why don't you need to dereference it?

Your name:

Reply:


Posted by Lars Eighner on 09/28/07 10:21

In our last episode,
<1190970878.641644.200330@o80g2000hse.googlegroups.com>,
the lovely and talented kenneth02394832
broadcast on comp.lang.php:

> On Sep 27, 11:59 pm, Lars Eighner <use...@larseighner.com> wrote:
>> In our last episode, <1190961700.418756.41...@50g2000hsm.googlegroups.com>,
>> the lovely and talented Summercool broadcast on comp.lang.php:
>>
>> > so many places, including the book PHP in a Nutshell, p. 80, it says:
>> > $a =& $b # set $a to reference $b
>> > if $a reference $b, then while you can say $b =1, you can't really
>> > say $a = 1. you need to say *($a) = 1 as in C or C++. Referencing
>> > must be coupled with dereferencing, and PHP is not doing the
>> > dereferencing, so why is it call referencing in the first place?
>> > (don't tell me PHP automatically dereference... as it will be really
>> > weird).
>> > and i think in the PHP group, people say "reference" to mean "alias".
>>
>> That is exactly what the manual says in Chapter 21. References Explained.
>> Instead of guessing, why not RTFM?


> does the manual say why there are two different types of references
> and they behaving differently and they just call it the same name?

What two different types of references?

> in all the languages i know, when you use

> a = 0
> b = 1

> that will break any relationship for variable a and b
> no, not for PHP.

Perhaps that is why it is called PHP and not another name.

> if there was ever a line

> $a =& $b

> some where before, then they are alias forever.

see unset.

> No other language i know does that, and then calling it reference to
> confuse with the other type of reference.

It's all a plot, isn't it?

--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 480 days to go.
What do you do when you're debranded?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация