You are here: Re: in PHP 5, $obj1 = $obj2 not the same as $obj1 =& $obj2 « PHP Programming Language « IT news, forums, messages
Re: in PHP 5, $obj1 = $obj2 not the same as $obj1 =& $obj2

Posted by Jerry Stuckle on 09/28/07 03:49

gosha bine wrote:
> Summercool wrote:
>> On Sep 27, 8:43 am, gosha bine <stereof...@gmail.com> wrote:
>>
>>> The manual is incorrect at this point. Object variables in php5 are
>>> assigned by value, just like in php4, but this very value is different
>>> in php5 - it's a pointer to the object, not the object itself. But this
>>> is essentially another story and has nothing to do with references.
>>>
>>> --
>>> gosha bine
>>
>> i think pointer and reference are the same thing, like in Java and
>> Ruby.
>

Not at all. I don't know about Ruby, but Java doesn't have pointers.

> The term "reference" can be used in the generic sense, describing a
> value that is used to access another value. In this sense, a pointer is
> a (kind of) reference. However, in c++ and php the word "reference" has
> another meaning, and describes some specific construct, that has nothing
> to do with pointers. Object variables in php5 are pointers and not
> references (in c++/php sense).
>

And that thinking really screws people up when the difference is important.

It's like an integer 1 and floating point 1.0. In many cases it's fine.
But not always.

>> In PHP, what the manual calls "reference" is actually not a reference
>> in other languages... it is like an alias or (a nickname).
>>
>
> Good that you understand this. It means your original problem is cleared
> up. ;)
>
>
>


--
==================
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

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