You are here: Re: if $a =& $b is assignment by reference, why don't you need to dereference it? « PHP Programming Language « IT news, forums, messages
Re: if $a =& $b is assignment by reference, why don't you need to dereference it?

Posted by Jerry Stuckle on 09/28/07 11:44

kenneth02394832 wrote:
> 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?
>
> in all the languages i know, when you use
>
> a = 0
> b = 1
>
> that will break any relationship for variable a and b
>

Not if a is a reference to b (or vice versa). True in all languages
which support references.

> no, not for PHP. if there was ever a line
>
> $a =& $b
>
> some where before, then they are alias forever. No other language i
> know does that, and then calling it reference to confuse with the
> other type of reference.
>
>

C++, Java... languages which support references.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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